8000 fix(jobs): rescue jobs orphaned by a restart by mwoods79 · Pull Request #745 · huddlz-hq/huddlz · GitHub
[go: up one dir, main page]

Skip to content

fix(jobs): rescue jobs orphaned by a restart - #745

Merged
mwoods79 merged 14 commits into
mainfrom
t3/rescue-orphaned-jobs
Dec 2, 2026
Merged

mwoods79 merged 14 commits into
mainfrom
t3/rescue-orphaned-jobs

Conversation

@mwoods79
@mwoods79 mwoods79 commented Dec 1, 2026 •
Copy link
Copy Markdown
Contributor

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.

SELECT worker, count(*), min(attempted_at) FROM oban_jobs WHERE state = 'executing' GROUP BY worker;

@mwoods79
mwoods79 enabled auto-merge (squash) December 1, 2026 23:26
@mwoods79
mwoods79 merged commit f2f7e46 into main Dec 2, 2026
8 of 10 checks passed
@mwoods79
mwoods79 deleted the t3/rescue-orphaned-jobs branch December 2, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0