fix: distinguish task deadlines from child operation timeouts

This commit is contained in:
Ed1s0nZ committed 2026-10-15 14:24:31 +08:00
1 parent 93e8684571
commit 5ff781bdb7
7 files changed
+134 -4

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
package handler
import (
"context"
"errors"
)
// taskDeadlineExceeded distinguishes the task's deadline from a child operation's
// timeout. A run error (including a cancellation cause) may wrap DeadlineExceeded
// while the task itself still has time remaining; it must not exhaust the task budget.
func taskDeadlineExceeded(taskCtx context.Context) bool {
return taskCtx != nil && errors.Is(taskCtx.Err(), context.DeadlineExceeded)
}