summaryrefslogtreecommitdiff
path: root/internal/task/task.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-22 22:53:13 +0300
committerPaul Buetow <paul@buetow.org>2026-06-22 22:53:13 +0300
commitc63fedb9aca43834dbe4df09d9de868a93f2b317 (patch)
treea319f106fd33f136a000854e27c1df5765b0aaf5 /internal/task/task.go
parent1b56533d656aea44cd1389309c44708b692dc36b (diff)
Fix annotation rollback cancellation (pq0)
Diffstat (limited to 'internal/task/task.go')
-rw-r--r--internal/task/task.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/internal/task/task.go b/internal/task/task.go
index ed0cd9c..604d4ca 100644
--- a/internal/task/task.go
+++ b/internal/task/task.go
@@ -616,20 +616,20 @@ func ReplaceAnnotations(ctx context.Context, id int, text string) error {
anns := tasks[0].Annotations
for i := len(anns) - 1; i >= 0; i-- {
if err := DenotateContext(ctx, id, anns[i].Description); err != nil {
- return replaceAnnotationsError(ctx, id, anns, err)
+ return replaceAnnotationsError(id, anns, err)
}
}
if text == "" {
return nil
}
if err := AnnotateContext(ctx, id, text); err != nil {
- return replaceAnnotationsError(ctx, id, anns, err)
+ return replaceAnnotationsError(id, anns, err)
}
return nil
}
-func replaceAnnotationsError(ctx context.Context, id int, anns []Annotation, err error) error {
- rollbackCtx, cancel := rollbackContext(ctx)
+func replaceAnnotationsError(id int, anns []Annotation, err error) error {
+ rollbackCtx, cancel := rollbackContext()
defer cancel()
if rollbackErr := restoreAnnotations(rollbackCtx, id, anns); rollbackErr != nil {
@@ -638,11 +638,8 @@ func replaceAnnotationsError(ctx context.Context, id int, anns []Annotation, err
return err
}
-func rollbackContext(ctx context.Context) (context.Context, context.CancelFunc) {
- if ctx.Err() != nil {
- return ctx, func() {}
- }
- return context.WithTimeout(ctx, 5*time.Second)
+func rollbackContext() (context.Context, context.CancelFunc) {
+ return context.WithTimeout(context.Background(), 5*time.Second)
}
func restoreAnnotations(ctx context.Context, id int, anns []Annotation) error {