Skip to content

Commit

Permalink
APIS-7042 Fix expiry time for intervals less than 1 day (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
petekirby-ee authored May 10, 2024
1 parent 084205f commit e4f66af
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e4f66af

Please sign in to comment.