Skip to content

Tag jobs with owning instance and reap orphans on boot - #176

Merged
SteRiccio merged 2 commits into
masterfrom
fix/job-orphaned-on-restart
Aug 25, 2026
Merged

Tag jobs with owning instance and reap orphans on boot#176
SteRiccio merged 2 commits into
masterfrom
fix/job-orphaned-on-restart

Conversation

@SteRiccio

Copy link
Copy Markdown
Member

A crashed or restarted dyno leaves its in-flight job row stuck at pending/running forever, which blocks that user/survey cluster-wide until the existing 60-minute stale-job reaper eventually catches it.

Stamp every inserted job row with the owning process' instanceId (ProcessEnv.instanceId) and add JobRepository.failOrphanedByInstanceId, so a fresh boot of the same dyno can immediately fail any pending/running row still tagged with its own instanceId - no staleness window needed, since a brand-new process couldn't have created that row itself. The time-based reaper remains as the fallback for a dyno that never comes back at all.

A crashed or restarted dyno leaves its in-flight job row stuck at
pending/running forever, which blocks that user/survey cluster-wide
until the existing 60-minute stale-job reaper eventually catches it.

Stamp every inserted job row with the owning process' instanceId
(ProcessEnv.instanceId) and add JobRepository.failOrphanedByInstanceId,
so a fresh boot of the same dyno can immediately fail any pending/running
row still tagged with its own instanceId - no staleness window needed,
since a brand-new process couldn't have created that row itself. The
time-based reaper remains as the fallback for a dyno that never comes
back at all.
@SteRiccio SteRiccio self-assigned this Aug 25, 2026
@sonarqubecloud

Copy link
Copy Markdown

@SteRiccio
SteRiccio merged commit e9a2726 into master Aug 25, 2026
6 checks passed
@SteRiccio
SteRiccio deleted the fix/job-orphaned-on-restart branch August 25, 2026 13:30
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