arazzo: make the retry sleeper injectable via EngineConfig.SleepFunc#600
Open
khalidDaoud wants to merge 1 commit into
Open
arazzo: make the retry sleeper injectable via EngineConfig.SleepFunc#600khalidDaoud wants to merge 1 commit into
khalidDaoud wants to merge 1 commit into
Conversation
The engine waits between retry attempts (a failure action's retryAfter) with a real context-aware timer. That default is right for standalone use, but hosts embedding the engine need to substitute their own wait: durable workflow runtimes (Temporal, DBOS, Restate) must use their replay-safe durable sleep — a real time.Timer inside a replayed workflow body blocks the scheduler or breaks determinism — and tests want a recording fake instead of a real wait. EngineConfig gains SleepFunc(ctx, d) error; nil keeps the existing sleepWithContext behavior, and a returned error aborts the workflow exactly as a cancelled context does today.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional
SleepFunc func(ctx context.Context, d time.Duration) errortoarazzo.EngineConfig, used for the wait between retry attempts (a failure action'sretryAfter).nilpreserves the existingsleepWithContextbehavior exactly; a returned error aborts the workflow the same way a cancelled context does today.Why
The engine is a great fit for embedding in durable workflow runtimes (Temporal, DBOS, Restate): its control flow is deterministic given the
Executorresponses, so a host can journal eachExecutecall and replay through the engine after a crash. The one wall-clock primitive in the loop is the retry sleep (engine.go→sleepWithContext), which such hosts must substitute with their own replay-safe durable timer — a realtime.Timerinside a replayed workflow body blocks the scheduler (Temporal's deadlock detector) or re-sleeps on recovery.It also lets tests exercise
retryAfterpaths with a recording fake instead of a real wait.Notes
nilfield ⇒ current default).WorkflowResult.Error).Context: we're using the arazzo engine inside a durable workflow engine (perflow), with each
Executor.Executejournaled as an exactly-once step — this field is the last piece needed for fully replay-safe embedding.