Skip to content

Commit 26be87f

Browse files
committed
fix timeout
1 parent 37bc13e commit 26be87f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/runtime/executor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ func (e *Executor) worker() {
262262
func (e *Executor) runTask(task task) error {
263263
ctx := task.ctx
264264
if e.taskTimeout > 0 {
265-
timeoutCtx, cancel := context.WithTimeout(ctx, e.taskTimeout)
266-
defer cancel()
265+
timeoutCtx, _ := context.WithTimeout(ctx, e.taskTimeout)
266+
// TODO: 这里不能主动取消,因为超时会自动触发上下文取消,下游其实有异步处理依赖。除非保证下游的所有异步都直接withoutCancel。
267267
ctx = timeoutCtx
268268
}
269269
ctx, span := otel.StartNamed(ctx, "runtime.executor.run")

0 commit comments

Comments
 (0)