From d76f3836a22c72d56006f3527715de3f381a0b6b 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index e4741cd221..cd57be74eb 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() @@ -1759,6 +1761,7 @@ func (fs *eosfs) convert(ctx context.Context, eosFileInfo *eosclient.FileInfo) ( Size: size, PermissionSet: fs.permissionSet(ctx, eosFileInfo, owner), Checksum: &xs, + Type: getResourceType(eosFileInfo.IsDir), Mtime: &types.Timestamp{ Seconds: eosFileInfo.MTimeSec, Nanos: eosFileInfo.MTimeNanos, @@ -1783,7 +1786,6 @@ func (fs *eosfs) convert(ctx context.Context, eosFileInfo *eosclient.FileInfo) ( } } - info.Type = getResourceType(eosFileInfo.IsDir) return info, nil }