Repository navigation
Release 0.8.0: record how a job ended in the transaction that ends it - #8
Merged
Merged
Conversation
An application keeping its own record of a job's work had no way to mark it when the job failed: a discard, an exhausted retry, an expiry, a cancel from the dashboard or a lease lapsing each ended the job in some statement of spool's, in whichever process, and the record was left saying pending (#6). A hook run inside those statements was weighed and refused: it would run application code in every sweep, roll back unrelated jobs when it failed, be global, and fire only where it was registered. Instead a failed job passes through a named state, failing, until a runner runs its kind's ~failed under a lease and settles it in the same transaction as the callback's write, so the job and the record commit together or not at all, and a crash leaves the job for another runner. ~completed does the same for a completion, replacing the separate committing handler. A job may also wait for others to end however they end, for a batch's last step. With it, waits are made sound: a job waited for is kept while anything waits for it and is read under a lock its ending waits for, so a wait never counts a job gone as completed nor misses one ending as it is written. The README shows the dashboard, and the quick start runs Postgres in Podman. AGENTS.md keeps only what the code and its checks do not say, and the docs reach their figure and screenshot by alias. The dashboard's page is built on solidtype 0.15, so its bundle stops lagging four releases behind the UI library it is written in.
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.
Why
An application keeping its own record of a job's work had no way to mark it when the job failed: a discard, an exhausted retry, an expiry, a cancel or a lapsed lease each ended the job in one of spool's statements, and the record was left pending (#6). A hook inside those statements was weighed and refused: it would run application code in every sweep, roll back unrelated jobs when it failed, and fire only where registered. Instead a failed job passes through a named state,
failing, until a runner runs its kind's~failedunder a lease and settles it in the transaction of the callback's write, so the job and the record commit together or not at all.Changes
Failinguntil settled, thenDiscardedorCancelled;Spool.Endingsays how it ended (Exhausted,Discarded,Expired,Cancelled), andinfo.endingcarries it.Spool.handle ?completed ?failedreplaceshandle_committing; each write commits in the transaction that ends the job.enqueue_after ~until:All_endedwaits for every job to end, however it ends, for a batch's last step.cancelstops a blocked job, and dooms only the dependents that wait for completion.Verified
make lint(0 findings) andmake test(17 and 75 cases) on the latest rowtype, wiretype, spindle and postgres-eio.Closes #6