From cf64ddfb143c8ac58907c4374d8dc25935da32c9 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 26 Jan 2023 15:14:22 +0300 Subject: [PATCH] [TrueCloudLab#13] pool: Renew token before it expired Signed-off-by: Denis Kirillov --- pool/cache.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pool/cache.go b/pool/cache.go index b051e5f2..a50da22f 100644 --- a/pool/cache.go +++ b/pool/cache.go @@ -67,5 +67,6 @@ func (c *sessionCache) updateEpoch(newEpoch uint64) { func (c *sessionCache) expired(val *cacheValue) bool { epoch := atomic.LoadUint64(&c.currentEpoch) - return val.token.ExpiredAt(epoch) + // use epoch+1 (clear cache beforehand) to prevent 'expired session token' error right after epoch tick + return val.token.ExpiredAt(epoch + 1) }