Skip to content

Fail tasks whose stored retry callback is gone from the code base - #87

Merged
codingjoe merged 4 commits into
mainfrom
codingjoe-reap-unreadable-payload
Oct 7, 2026
Merged

codingjoe merged 4 commits into
mainfrom
codingjoe-reap-unreadable-payload

Conversation

@codingjoe

@codingjoe codingjoe commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

_reap_running_queue skipped a payload whose stored retry callback was gone from the code base. The claim script had already renewed the lease, so the task stayed in the running set and the broker logged the same ImportError every CLAIM_TTL. The inspector could not list or clear it.

  • Reap a claimed task whose stored retry callback cannot be imported: drop the callback so the payload stays readable, record an ImportError beside the AcknowledgementTimeout, and acknowledge the failure through the regular result path.
  • The task leaves the running set, shows up on the Failed tab, and can be requeued or dropped from the inspector.
  • Document the behavior in the README.

Fix #78

The running reaper skipped a payload it could not deserialize. The
claim script had already renewed the lease, so the task stayed in the
running set and the broker logged the same ImportError every
CLAIM_TTL. The inspector could not list or clear it.

The reaper now fails such a task. It drops the unimportable retry
callback, records an ImportError beside the lease timeout, and
acknowledges the failure through the regular result path. The task
leaves the running set, shows on the Failed tab, and can be requeued or
dropped.
CONTRIBUTING.md says we do not guard against Redis data altered
mid-flight, we fail loudly instead. The helper reads the task hash
right after the claim returned that same key, so the guard is dead
code that hides a failure instead of surfacing it.
Private methods in this module carry a single summary line. The
explanation of the payload rewrite belongs in the user docs, which
already describe the terminal failure.
The handler only had one caller and passing the ImportError as an
argument read awkwardly. It now runs where the exception is caught.
@codingjoe
codingjoe merged commit c1bffa8 into main Oct 7, 2026
4 checks passed
@codingjoe
codingjoe deleted the codingjoe-reap-unreadable-payload branch October 7, 2026 12:30
codingjoe added a commit that referenced this pull request Oct 7, 2026
The reaper read the stored payload before deciding the fate of a task,
so a payload the code can no longer read, a task function or retry
callback that is gone, or a status a newer release wrote, raised on
every pass. The claim script had already renewed the lease, so the task
stayed in the running set and the same error repeated every `CLAIM_TTL`,
and the inspector could not clear it.

- Drop a claimed task the broker cannot read: log the read error with
its traceback, and delete the stored payload.
- Delete only the payload, not the running entry. A lease holder's late
acknowledge still writes its result, and the reaper script sweeps the
entry once the hash is gone.
- Replace the import-error salvage from #87, which patched and published
the payload, with that one drop. The source file is a net deletion.
- Document the behavior in the README.

Fixes #73
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.

An unreadable task payload stays stored with no way to clear it

1 participant