diff options
author | Harald Musum <musum@yahooinc.com> | 2024-06-11 13:46:26 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2024-06-11 13:46:26 +0200 |
commit | a6157cc3b357e224ee38f7145ed31728c1278aca (patch) | |
tree | ef47298961205a1f168621b327cdc48401498b8c /configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java | |
parent | 52a289d4b039c29fe763f8e758eff8a0e57bf005 (diff) |
Use the clock that is already available
Diffstat (limited to 'configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java index ac483ea20c9..842c19382dd 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java @@ -373,7 +373,7 @@ public class SessionRepository { return session; } - public int deleteExpiredRemoteSessions(Clock clock, Predicate<Session> sessionIsActiveForApplication) { + public int deleteExpiredRemoteSessions(Predicate<Session> sessionIsActiveForApplication) { Duration expiryTime = Duration.ofSeconds(expiryTimeFlag.value()); List<Long> remoteSessionsFromZooKeeper = getRemoteSessionsFromZooKeeper(); log.log(Level.FINE, () -> "Remote sessions for tenant " + tenantName + ": " + remoteSessionsFromZooKeeper); @@ -386,7 +386,7 @@ public class SessionRepository { if (session == null) session = new RemoteSession(tenantName, sessionId, createSessionZooKeeperClient(sessionId)); if (session.getStatus() == Session.Status.ACTIVATE && sessionIsActiveForApplication.test(session)) continue; - if (sessionHasExpired(session.getCreateTime(), expiryTime, clock)) { + if (sessionHasExpired(session.getCreateTime(), expiryTime)) { log.log(Level.FINE, () -> "Remote session " + sessionId + " for " + tenantName + " has expired, deleting it"); deleteRemoteSessionFromZooKeeper(session); deleted++; @@ -411,7 +411,7 @@ public class SessionRepository { transaction.close(); } - private boolean sessionHasExpired(Instant created, Duration expiryTime, Clock clock) { + private boolean sessionHasExpired(Instant created, Duration expiryTime) { return created.plus(expiryTime).isBefore(clock.instant()); } |