From 0f5aef93b87fb215e3e7147f18c490bc81fff609 Mon Sep 17 00:00:00 2001 From: Ishank Arora Date: Thu, 11 Nov 2021 12:17:10 +0100 Subject: [PATCH] Only retry for expired keys --- pkg/storage/utils/eosfs/eosfs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index e4741cd2210..154d243dd01 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -214,7 +214,9 @@ func NewEOSFS(c *Config) (storage.FS, error) { eosfs.userIDCache.SetExpirationReasonCallback(func(key string, reason ttlcache.EvictionReason, value interface{}) { // We only set those keys with TTL which we weren't able to retrieve the last time // For those keys, try to contact the userprovider service again when they expire - _, _ = eosfs.getUserIDGateway(context.Background(), key) + if reason == ttlcache.Expired { + _, _ = eosfs.getUserIDGateway(context.Background(), key) + } }) go eosfs.userIDcacheWarmup()