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

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
remotes/1719900476480179218/tmp_refs/heads/KirillovDenis/poc/impersonate
Denis Kirillov 2023-01-26 15:14:22 +03:00 committed by Alex Vanin
parent cf9a54dcda
commit cf64ddfb14
1 changed files with 2 additions and 1 deletions

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