workaround for cache invalidation
This commit is contained in:
parent
65739c9307
commit
c84f94372e
@ -6,6 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/graph-gophers/dataloader"
|
"github.com/graph-gophers/dataloader"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func invalidateCache(ctx context.Context, id string) error {
|
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")
|
return fmt.Errorf("Failed to get loader from context")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debug("Invalidate cache for id: ", id)
|
||||||
|
|
||||||
loader["getFile"].Clear(ctx, dataloader.StringKey(id))
|
loader["getFile"].Clear(ctx, dataloader.StringKey(id))
|
||||||
loader["listObjects"].Clear(ctx, dataloader.StringKey(id))
|
|
||||||
loader["getFiles"].Clear(ctx, dataloader.StringKey(getPathFromId(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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user