Skip to content

Commit d16d7bd

Browse files
committed
fix: correct off-by-one in retry attempts (addressing review feedback)
- Change <= to < so MAX_RETRIES=3 means 3 attempts, not 4 - Update isLastAttempt check accordingly
1 parent 278daf6 commit d16d7bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class PauseResumeManager {
172172
const RETRY_DELAY_MS = 200
173173
let lastError: Error | null = null
174174

175-
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
175+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
176176
try {
177177
return await db.transaction(async (tx) => {
178178
const pausedExecution = await tx
@@ -291,7 +291,7 @@ export class PauseResumeManager {
291291
} catch (err: any) {
292292
lastError = err
293293
const isNotFound = err.message?.includes('Paused execution not found')
294-
const isLastAttempt = attempt === MAX_RETRIES
294+
const isLastAttempt = attempt === MAX_RETRIES - 1
295295

296296
if (!isNotFound || isLastAttempt) {
297297
throw err

0 commit comments

Comments
 (0)