From c84f94372e21f2a20956bb6b3a12c5a9c6f7d846 Mon Sep 17 00:00:00 2001 From: Niklas Date: Mon, 16 Aug 2021 22:40:10 +0200 Subject: [PATCH] workaround for cache invalidation --- internal/helper.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/helper.go b/internal/helper.go index 2709e7c..a0ba33b 100644 --- a/internal/helper.go +++ b/internal/helper.go @@ -6,6 +6,7 @@ import ( "path/filepath" "github.com/graph-gophers/dataloader" + log "github.com/sirupsen/logrus" ) func invalidateCache(ctx context.Context, id string) error { @@ -14,10 +15,15 @@ func invalidateCache(ctx context.Context, id string) error { return fmt.Errorf("Failed to get loader from context") } + log.Debug("Invalidate cache for id: ", id) + loader["getFile"].Clear(ctx, dataloader.StringKey(id)) - loader["listObjects"].Clear(ctx, dataloader.StringKey(id)) loader["getFiles"].Clear(ctx, dataloader.StringKey(getPathFromId(id))) + // FIXME: this is the only way i can invalidate the cache without it breaking stuff + // loader["listObjects"].Clear(ctx, dataloader.StringKey(id)) + loader["listObjects"].ClearAll() + return nil }