diff --git a/changelog/unreleased/fix-caching.md b/changelog/unreleased/fix-caching.md new file mode 100644 index 0000000000..82f22b10f9 --- /dev/null +++ b/changelog/unreleased/fix-caching.md @@ -0,0 +1,5 @@ +Bugfix: Fix caching + +Do not cache files that are in processing. + +https://github.com/cs3org/reva/pull/3700 diff --git a/internal/grpc/services/gateway/storageprovidercache.go b/internal/grpc/services/gateway/storageprovidercache.go index 46b0b0c626..806018d643 100644 --- a/internal/grpc/services/gateway/storageprovidercache.go +++ b/internal/grpc/services/gateway/storageprovidercache.go @@ -112,6 +112,8 @@ func (c *cachedAPIClient) Stat(ctx context.Context, in *provider.StatRequest, op // we do not know when to invalidate them // FIXME: find a way to cache/invalidate them too return resp, nil + case utils.ReadPlainFromOpaque(resp.GetInfo().GetOpaque(), "status") == "processing": + return resp, nil default: return resp, c.statCache.PushToCache(key, resp) } diff --git a/pkg/storage/utils/decomposedfs/decomposedfs.go b/pkg/storage/utils/decomposedfs/decomposedfs.go index 87ceaadbd4..9ca49690e6 100644 --- a/pkg/storage/utils/decomposedfs/decomposedfs.go +++ b/pkg/storage/utils/decomposedfs/decomposedfs.go @@ -231,11 +231,11 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) { } } + upload.Cleanup(up, failed, keepUpload) + // remove cache entry in gateway fs.cache.RemoveStat(ev.ExecutingUser.GetId(), &provider.ResourceId{SpaceId: n.SpaceID, OpaqueId: n.ID}) - upload.Cleanup(up, failed, keepUpload) - if err := events.Publish( fs.stream, events.UploadReady{