From a23e7bfb82984fd88c42aa09365b25333089d071 Mon Sep 17 00:00:00 2001 From: Srigovind Nayak Date: Sun, 11 Aug 2024 15:43:03 +0530 Subject: [PATCH] cache: check for context cancellation before clearing cache --- internal/backend/cache/backend.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/backend/cache/backend.go b/internal/backend/cache/backend.go index 92cca4d0e..58b03dd38 100644 --- a/internal/backend/cache/backend.go +++ b/internal/backend/cache/backend.go @@ -247,6 +247,10 @@ func (b *Backend) List(ctx context.Context, t backend.FileType, fn func(f backen return err } + if ctx.Err() != nil { + return ctx.Err() + } + // clear the cache for files that are not in the repo anymore, ignore errors err = b.Cache.Clear(t, ids) if err != nil {