Repository navigation
fix(jobs): rescue jobs orphaned by a restart - #745
Merged
Merged
Conversation
Bound worker execution below the rescue age and persist handoff state so recovering mail, posts, and recurring huddlz preserves completed work.
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.
Summary
Lifeline recovers jobs left executing for an hour. Worker attempts have a 30-minute ceiling, with shorter limits for series generation, sitemap refresh and slug repair. Fly gives the application 45 seconds to shut down, including Oban’s 15-second grace period.
Mail jobs retry unacknowledged sends. An interrupted password reset sends a replacement link and revokes the previous link from that request. Social posts retry definite refusals within their 15-minute window. An unconfirmed post appears in Recent Posts as “Didn't send.” Queued announcements and notifications use current series membership at delivery.
Recurring generation preserves existing huddlz, reservations and covers. If a restart interrupts the final attempt, a five-minute check queues the existing organizer failure notice once for unfinished generation. Directly queued image cleanup jobs also retain retry attempts.
Evidence
Before: Provider stubs reproduced permanent mail cancellation after a dropped connection, timeout or TLS failure. A rescued job with no handoff record or an interrupted handoff also cancelled. A refused webhook connection completed its job without delivering the post.
After: Recovery tests exercise approval, invitation and notification mail across handoff states. They verify that an acknowledged send stays acknowledged, a later attempt delivers after the provider recovers, and only the replacement password reset link works. Webhook tests cover refusal, recovery, expiry and ambiguous responses. Organizer scenarios run reporting twice after a final attempt. An unfinished series produces one notice and one queued email. A previously reported failure stays at one notice, and a fully generated series produces none.
Merge Danger
Door: two-way for the application and configuration. Messages already delivered and links already replaced retain those effects after a rollback.
Blast Radius: workers and outbound delivery.
On first deployment, existing jobs left executing for more than an hour become eligible for Lifeline’s next sweep. Jobs with attempts remaining return to the queue, including jobs that predate this change. Exhausted jobs are discarded. The rollout migration marks series jobs already discarded as handled. Jobs still executing remain eligible for rescue. The reporter checks the current schedule against committed series dates before queuing an organizer notice.
An email accepted just before a restart can arrive twice if its acknowledgement was lost. A social post with an unknown outcome can appear as “Didn't send” even if the platform received it.
Before deploying, inspect the count and oldest start time of currently executing jobs by worker.