From e4f66afc5fdba1d5315a1a85461d9a2b2ee4dbc1 Mon Sep 17 00:00:00 2001 From: petekirby-ee Date: Fri, 10 May 2024 17:21:11 +0100 Subject: [PATCH] APIS-7042 Fix expiry time for intervals less than 1 day (#493) --- .../scheduled/UpliftVerificationExpiryJob.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/uk/gov/hmrc/thirdpartyapplication/scheduled/UpliftVerificationExpiryJob.scala b/app/uk/gov/hmrc/thirdpartyapplication/scheduled/UpliftVerificationExpiryJob.scala index 2f9ad2a29..07ad4d5b4 100644 --- a/app/uk/gov/hmrc/thirdpartyapplication/scheduled/UpliftVerificationExpiryJob.scala +++ b/app/uk/gov/hmrc/thirdpartyapplication/scheduled/UpliftVerificationExpiryJob.scala @@ -16,7 +16,8 @@ package uk.gov.hmrc.thirdpartyapplication.scheduled -import java.time.{Clock, Instant, Period} +import java.time.temporal.ChronoUnit.SECONDS +import java.time.{Clock, Instant} import javax.inject.Inject import scala.concurrent.duration.{Duration, DurationInt, FiniteDuration} import scala.concurrent.{ExecutionContext, Future} @@ -68,7 +69,7 @@ class UpliftVerificationExpiryJob @Inject() ( } override def runJob(implicit ec: ExecutionContext): Future[RunningOfJobSuccessful] = { - val expiredTime: Instant = instant().minus(Period.ofDays(upliftVerificationValidity.toDays.toInt)) + val expiredTime: Instant = Instant.now(clock).minus(upliftVerificationValidity.toSeconds, SECONDS) logger.info(s"Move back applications to TESTING having status 'PENDING_REQUESTER_VERIFICATION' with timestamp earlier than $expiredTime") val result: Future[RunningOfJobSuccessful.type] = for {