Add WithLongRunningSteps option for handlers that run for extended periods#26
Open
sosiska wants to merge 1 commit intofloxy-project:mainfrom
Open
Add WithLongRunningSteps option for handlers that run for extended periods#26sosiska wants to merge 1 commit intofloxy-project:mainfrom
sosiska wants to merge 1 commit intofloxy-project:mainfrom
Conversation
…riods This mode splits step execution into separate transactions: - Transaction 1: dequeue + update to "running" + commit (status immediately visible) - Handler execution outside transaction (DB connection released) - Transaction 2: record result Solves connection pool exhaustion and invisible "running" status for long handlers.
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.
Problem
When using Floxy with handlers that take a long time to execute (20-80 minutes), the entire
ExecuteNextoperation runs within a single database transaction. This causes:pendinguntil handler completes (PostgreSQLREAD COMMITTED)Solution
Add
WithLongRunningSteps()engine option that splits step execution into separate transactions:How it works:
running, remove from queue, commitScope:
Trade-offs
runningstatus — users should implement a recovery mechanismStepContext.IdempotencyKey()Changes
engine_opts.go: addWithLongRunningSteps()optionengine.go: addexecuteNextLongRunning()method andlongRunningStepContextstructengine_long_running_test.go: tests for the new modedocs/ENGINE_SPEC.md: documentationTesting
All existing tests pass. Added new tests covering: