Skip to content

Commit 35e559f

Browse files
committed
WorkflowStatusMaxRecoveryAttemptsExceeded
1 parent f183e1e commit 35e559f

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

dbos/admin_server_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ func TestAdminServer(t *testing.T) {
455455
"start_time": timeBetween.Format(time.RFC3339Nano),
456456
"limit": 10,
457457
}
458-
fmt.Println("Request body 2:", reqBody2, "timebetween", timeBetween.UnixMilli())
459458
req2, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer(mustMarshal(reqBody2)))
460459
require.NoError(t, err, "Failed to create request 2")
461460
req2.Header.Set("Content-Type", "application/json")
@@ -469,7 +468,6 @@ func TestAdminServer(t *testing.T) {
469468
var workflows2 []map[string]any
470469
err = json.NewDecoder(resp2.Body).Decode(&workflows2)
471470
require.NoError(t, err, "Failed to decode workflows response 2")
472-
fmt.Println(workflows2)
473471

474472
// Should have exactly 1 workflow (the second one)
475473
assert.Equal(t, 1, len(workflows2), "Expected exactly 1 workflow with start_time after timeBetween")

dbos/queues_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ func TestWorkflowQueues(t *testing.T) {
233233
for {
234234
dlqStatus, err := dlqHandle[0].GetStatus()
235235
require.NoError(t, err, "failed to get status of DLQ workflow handle")
236-
if dlqStatus.Status != WorkflowStatusRetriesExceeded && retries < 10 {
236+
if dlqStatus.Status != WorkflowStatusMaxRecoveryAttemptsExceeded && retries < 10 {
237237
time.Sleep(1 * time.Second) // Wait a bit before checking again
238238
retries++
239239
continue
240240
}
241241
require.NoError(t, err, "failed to get status of DLQ workflow handle")
242-
assert.Equal(t, WorkflowStatusRetriesExceeded, dlqStatus.Status, "expected workflow to be in DLQ after max retries exceeded")
242+
assert.Equal(t, WorkflowStatusMaxRecoveryAttemptsExceeded, dlqStatus.Status, "expected workflow to be in DLQ after max retries exceeded")
243243
handles = append(handles, dlqHandle[0])
244244
break
245245
}

dbos/system_database.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,17 +431,17 @@ func (s *sysDB) insertWorkflowStatus(ctx context.Context, input insertWorkflowSt
431431
WHERE workflow_uuid = $2 AND status = $3`
432432

433433
_, err = input.tx.Exec(ctx, dlqQuery,
434-
WorkflowStatusRetriesExceeded,
434+
WorkflowStatusMaxRecoveryAttemptsExceeded,
435435
input.status.ID,
436436
WorkflowStatusPending)
437437

438438
if err != nil {
439-
return nil, fmt.Errorf("failed to update workflow to %s: %w", WorkflowStatusRetriesExceeded, err)
439+
return nil, fmt.Errorf("failed to update workflow to %s: %w", WorkflowStatusMaxRecoveryAttemptsExceeded, 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 %s: %w", WorkflowStatusRetriesExceeded, err)
444+
return nil, fmt.Errorf("failed to commit transaction after marking workflow as %s: %w", WorkflowStatusMaxRecoveryAttemptsExceeded, err)
445445
}
446446

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

dbos/workflow.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import (
2222
type WorkflowStatusType string
2323

2424
const (
25-
WorkflowStatusPending WorkflowStatusType = "PENDING" // Workflow is running or ready to run
26-
WorkflowStatusEnqueued WorkflowStatusType = "ENQUEUED" // Workflow is queued and waiting for execution
27-
WorkflowStatusSuccess WorkflowStatusType = "SUCCESS" // Workflow completed successfully
28-
WorkflowStatusError WorkflowStatusType = "ERROR" // Workflow completed with an error
29-
WorkflowStatusCancelled WorkflowStatusType = "CANCELLED" // Workflow was cancelled (manually or due to timeout)
30-
WorkflowStatusRetriesExceeded WorkflowStatusType = "MAX_RECOVERY_ATTEMPTS_EXCEEDED" // Workflow exceeded maximum retry attempts
25+
WorkflowStatusPending WorkflowStatusType = "PENDING" // Workflow is running or ready to run
26+
WorkflowStatusEnqueued WorkflowStatusType = "ENQUEUED" // Workflow is queued and waiting for execution
27+
WorkflowStatusSuccess WorkflowStatusType = "SUCCESS" // Workflow completed successfully
28+
WorkflowStatusError WorkflowStatusType = "ERROR" // Workflow completed with an error
29+
WorkflowStatusCancelled WorkflowStatusType = "CANCELLED" // Workflow was cancelled (manually or due to timeout)
30+
WorkflowStatusMaxRecoveryAttemptsExceeded WorkflowStatusType = "MAX_RECOVERY_ATTEMPTS_EXCEEDED" // Workflow exceeded maximum retry attempts
3131
)
3232

3333
// WorkflowStatus contains comprehensive information about a workflow's current state and execution history.

dbos/workflows_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ func TestWorkflowDeadLetterQueue(t *testing.T) {
12161216
// Verify workflow status is MAX_RECOVERY_ATTEMPTS_EXCEEDED
12171217
status, err := handle.GetStatus()
12181218
require.NoError(t, err, "failed to get workflow status")
1219-
require.Equal(t, WorkflowStatusRetriesExceeded, status.Status)
1219+
require.Equal(t, WorkflowStatusMaxRecoveryAttemptsExceeded, status.Status)
12201220

12211221
// Verify that attempting to start a workflow with the same ID throws a DLQ error
12221222
_, err = RunAsWorkflow(dbosCtx, deadLetterQueueWorkflow, "test", WithWorkflowID(wfID))

0 commit comments

Comments
 (0)