aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/pkg.go')
-rw-r--r--internal/pkg/pkg.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go
index 0ad39a4b..e94cf9c4 100644
--- a/internal/pkg/pkg.go
+++ b/internal/pkg/pkg.go
@@ -1120,7 +1120,7 @@ func (c *Cache) Done(id unique.Handle[ID]) <-chan struct{} {
// Cancel cancels the ongoing cure of an [Artifact] referred to by the specified
// identifier. Cancel returns whether the [context.CancelFunc] has been killed.
-// Cancel does not wait for the cure to complete.
+// Cancel returns after the cure is complete.
func (c *Cache) Cancel(id unique.Handle[ID]) bool {
c.identMu.RLock()
pending, ok := c.identPending[id]
@@ -1129,6 +1129,13 @@ func (c *Cache) Cancel(id unique.Handle[ID]) bool {
return false
}
pending.cancel()
+ <-pending.done
+
+ c.abortMu.Lock()
+ c.identMu.Lock()
+ delete(c.identErr, id)
+ c.identMu.Unlock()
+ c.abortMu.Unlock()
return true
}