Skip to content

Commit 45ed85d

Browse files
committed
Add abort check in retry countdown loop
Allows early exit from exponential backoff if task is cancelled during delay
1 parent c135224 commit 45ed85d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/task/Task.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,11 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
28742874

28752875
// Show countdown timer with exponential backoff
28762876
for (let i = finalDelay; i > 0; i--) {
2877+
// Check abort flag during countdown to allow early exit
2878+
if (this.abort) {
2879+
throw new Error(`[Task#${this.taskId}] Aborted during retry countdown`)
2880+
}
2881+
28772882
await this.say(
28782883
"api_req_retry_delayed",
28792884
`${headerText}Retry attempt ${retryAttempt + 1}\nRetrying in ${i} seconds...`,

0 commit comments

Comments
 (0)