Clear known from runs hash on cancel so add() can reschedule#336
Merged
chrisguidry merged 1 commit intomainfrom Feb 14, 2026
Merged
Clear known from runs hash on cancel so add() can reschedule#336chrisguidry merged 1 commit intomainfrom
known from runs hash on cancel so add() can reschedule#336chrisguidry merged 1 commit intomainfrom
Conversation
When a scheduled task gets cancelled via `docket.cancel()`, the cancel Lua script removes it from the stream/queue but leaves the `known` field in the runs hash. Later, when `_schedule_all_automatic_perpetual_tasks` (or any `docket.add()`) tries to reschedule the same key, the schedule script sees `known` and returns EXISTS. The task stays silently unscheduled until `execution_ttl` expires (default 15 min). The fix adds an `HDEL runs_key 'known' 'stream_id'` to the cancel script, clearing the dedup markers while keeping `state=cancelled` and `completed_at` for observability. The schedule script's existing fallback (`state == 'running'` → EXISTS) already handles cancelled tasks correctly once `known` is gone. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
📚 Documentation has been built for this PR! You can download the documentation directly here: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #336 +/- ##
=======================================
Coverage 98.67% 98.68%
=======================================
Files 103 103
Lines 10375 10386 +11
Branches 496 496
=======================================
+ Hits 10238 10249 +11
Misses 121 121
Partials 16 16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
When a scheduled task gets cancelled via
docket.cancel(), the cancel Luascript removes it from the stream/queue but leaves the
knownfield in theruns hash. Later, when
_schedule_all_automatic_perpetual_tasks(or anydocket.add()) tries to reschedule the same key, the schedule script seesknownand returns EXISTS. The task stays silently unscheduled untilexecution_ttlexpires (default 15 min).The fix adds an
HDEL runs_key 'known' 'stream_id'to the cancel script,clearing the dedup markers while keeping
state=cancelledandcompleted_atfor observability. The schedule script's existing fallback (
state == 'running'→ EXISTS) already handles cancelled tasks correctly once
knownis gone.🤖 Generated with Claude Code