Skip to content

Commit f183e1e

Browse files
committed
MAX_RECOVERY_ATTEMPTS_EXCEEDED
1 parent 0d57105 commit f183e1e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

dbos/system_database.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,11 @@ func (s *sysDB) insertWorkflowStatus(ctx context.Context, input insertWorkflowSt
421421
}
422422

423423
// Every time we start executing a workflow (and thus attempt to insert its status), we increment `recovery_attempts` by 1.
424-
// When this number becomes equal to `maxRetries + 1`, we mark the workflow as `RETRIES_EXCEEDED`.
424+
// When this number becomes equal to `maxRetries + 1`, we mark the workflow as `MAX_RECOVERY_ATTEMPTS_EXCEEDED`.
425425
if result.status != WorkflowStatusSuccess && result.status != WorkflowStatusError &&
426426
input.maxRetries > 0 && result.attempts > input.maxRetries+1 {
427427

428-
// Update workflow status to RETRIES_EXCEEDED and clear queue-related fields
428+
// Update workflow status to MAX_RECOVERY_ATTEMPTS_EXCEEDED and clear queue-related fields
429429
dlqQuery := `UPDATE dbos.workflow_status
430430
SET status = $1, deduplication_id = NULL, started_at_epoch_ms = NULL, queue_name = NULL
431431
WHERE workflow_uuid = $2 AND status = $3`
@@ -436,12 +436,12 @@ func (s *sysDB) insertWorkflowStatus(ctx context.Context, input insertWorkflowSt
436436
WorkflowStatusPending)
437437

438438
if err != nil {
439-
return nil, fmt.Errorf("failed to update workflow to RETRIES_EXCEEDED: %w", err)
439+
return nil, fmt.Errorf("failed to update workflow to %s: %w", WorkflowStatusRetriesExceeded, err)
440440
}
441441

442442
// Commit the transaction before throwing the error
443443
if err := input.tx.Commit(ctx); err != nil {
444-
return nil, fmt.Errorf("failed to commit transaction after marking workflow as RETRIES_EXCEEDED: %w", err)
444+
return nil, fmt.Errorf("failed to commit transaction after marking workflow as %s: %w", WorkflowStatusRetriesExceeded, err)
445445
}
446446

447447
return nil, newDeadLetterQueueError(input.status.ID, input.maxRetries)

dbos/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ const (
317317

318318
// WithMaxRetries sets the maximum number of retry attempts for workflow recovery.
319319
// If a workflow fails or is interrupted, it will be retried up to this many times.
320-
// After exceeding max retries, the workflow status becomes RETRIES_EXCEEDED.
320+
// After exceeding max retries, the workflow status becomes MAX_RECOVERY_ATTEMPTS_EXCEEDED.
321321
func WithMaxRetries(maxRetries int) WorkflowRegistrationOption {
322322
return func(p *WorkflowRegistrationOptions) {
323323
p.maxRetries = maxRetries

dbos/workflows_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ func TestWorkflowDeadLetterQueue(t *testing.T) {
12131213
require.True(t, ok, "expected DBOSError, got %T", err)
12141214
require.Equal(t, DeadLetterQueueError, dbosErr.Code)
12151215

1216-
// Verify workflow status is RETRIES_EXCEEDED
1216+
// Verify workflow status is MAX_RECOVERY_ATTEMPTS_EXCEEDED
12171217
status, err := handle.GetStatus()
12181218
require.NoError(t, err, "failed to get workflow status")
12191219
require.Equal(t, WorkflowStatusRetriesExceeded, status.Status)

0 commit comments

Comments
 (0)