aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-18 03:20:44 +0900
committerOphestra <cat@gensokyo.uk>2026-04-18 03:24:48 +0900
commit9e752b588a66319c20a42dda761c43df5a5ad488 (patch)
treea8c5829718a09683faaa0d59e3cd9095f18e9e28 /internal/pkg/pkg.go
parent27b1aaae386578caadcdc2d34b7e1b5d78374efc (diff)
internal/pkg: drop cached error on cancel
This avoids disabling the artifact when using the individual cancel method. Unfortunately this makes the method blocking. Signed-off-by: Ophestra <cat@gensokyo.uk>
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
}