Skip to content

Commit eb72c75

Browse files
committed
force time between created_at
1 parent 05041a4 commit eb72c75

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

dbos/queues_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ func TestPriorityQueue(t *testing.T) {
10651065
require.NoError(t, err)
10661066
wfHandles = append(wfHandles, handle6)
10671067

1068+
time.Sleep(10 * time.Millisecond) // Avoid collisions in created_at...
10681069
handle7, err := RunAsWorkflow(dbosCtx, testWorkflow, 7, WithQueue(priorityQueue.Name))
10691070
require.NoError(t, err)
10701071
wfHandles = append(wfHandles, handle7)

dbos/system_database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func (s *sysDB) insertWorkflowStatus(ctx context.Context, input insertWorkflowSt
373373
input.status.ExecutorID,
374374
applicationVersion,
375375
input.status.ApplicationID,
376-
input.status.CreatedAt.UnixMilli(),
376+
input.status.CreatedAt.Round(time.Millisecond).UnixMilli(), // slightly reduce the likelihood of collisions
377377
attempts,
378378
updatedAt.UnixMilli(),
379379
timeoutMs,

dbos/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func RunAsWorkflow[P any, R any](ctx DBOSContext, fn GenericWorkflowFunc[P, R],
572572
}
573573
}()
574574

575-
typedHandle := newWorkflowHandle[R](handle.dbosContext, handle.workflowID, typedOutcomeChan)
575+
typedHandle := newWorkflowHandle(handle.dbosContext, handle.workflowID, typedOutcomeChan)
576576

577577
return typedHandle, nil
578578
}

0 commit comments

Comments
 (0)