Skip to content

Commit 2e17fe3

Browse files
committed
docs: add critical comments explaining abort checks
- Document the importance of abort checks after backoff - Explain how these checks prevent infinite loops - Add context for future maintainability
1 parent 2f4d085 commit 2e17fe3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/task/Task.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
28012801
// Apply shared exponential backoff and countdown UX
28022802
await this.backoffAndAnnounce(retryAttempt, error, errorMsg)
28032803

2804-
// Check if task was aborted during the backoff
2804+
// CRITICAL: Check if task was aborted during the backoff countdown
2805+
// This prevents infinite loops when users cancel during auto-retry
2806+
// Without this check, the recursive call below would continue even after abort
28052807
if (this.abort) {
28062808
throw new Error(
28072809
`[Task#attemptApiRequest] task ${this.taskId}.${this.instanceId} aborted during retry`,

0 commit comments

Comments
 (0)