check error when setting cache with ttl

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2022-01-17 15:39:15 +00:00
parent 75bfd71355
commit 94d6daa222
2 changed files with 10 additions and 4 deletions
+9 -3
View File
@@ -525,7 +525,9 @@ func (g Graph) getExtendedSpaceProperties(ctx context.Context, space *storagepro
spaceProperties: ExtendedSpaceProperties{},
rootMtime: space.Mtime,
}
g.spacePropertiesCache.SetWithTTL(spaceRootStatKey(space.Root), spacePropertiesEntry, time.Second*time.Duration(g.config.Spaces.ExtendedSpacePropertiesCacheTTL))
if err := g.spacePropertiesCache.SetWithTTL(spaceRootStatKey(space.Root), spacePropertiesEntry, time.Second*time.Duration(g.config.Spaces.ExtendedSpacePropertiesCacheTTL)); err != nil {
g.logger.Error().Err(err).Msg("could not cache extended space properties")
}
return &spacePropertiesEntry.spaceProperties, nil
default:
@@ -567,7 +569,9 @@ func (g Graph) getExtendedSpaceProperties(ctx context.Context, space *storagepro
spaceProperties: ExtendedSpaceProperties{},
rootMtime: space.Mtime,
}
g.spacePropertiesCache.SetWithTTL(spaceRootStatKey(space.Root), spacePropertiesEntry, time.Second*time.Duration(g.config.Spaces.ExtendedSpacePropertiesCacheTTL))
if err := g.spacePropertiesCache.SetWithTTL(spaceRootStatKey(space.Root), spacePropertiesEntry, time.Second*time.Duration(g.config.Spaces.ExtendedSpacePropertiesCacheTTL)); err != nil {
g.logger.Error().Err(err).Msg("could not cache extended space properties")
}
return &spacePropertiesEntry.spaceProperties, nil
default:
@@ -584,7 +588,9 @@ func (g Graph) getExtendedSpaceProperties(ctx context.Context, space *storagepro
spaceProperties: spaceProperties,
rootMtime: space.Mtime,
}
g.spacePropertiesCache.SetWithTTL(spaceRootStatKey(space.Root), spacePropertiesEntry, time.Second*time.Duration(g.config.Spaces.ExtendedSpacePropertiesCacheTTL))
if err := g.spacePropertiesCache.SetWithTTL(spaceRootStatKey(space.Root), spacePropertiesEntry, time.Second*time.Duration(g.config.Spaces.ExtendedSpacePropertiesCacheTTL)); err != nil {
g.logger.Error().Err(err).Msg("could not cache extended space properties")
}
return &spaceProperties, nil
}