[TrueCloudLab#13] pool: Renew token before it expired

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-01-26 15:14:22 +03:00 committed by Alex Vanin
parent cf9a54dcda
commit cf64ddfb14

View file

@ -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)
}