Add ox_prune --queue, to match ox_health --queue - #40
Merged
Merged
Conversation
A deployment keeping two queues with different retention needs had no way to prune them separately. `--queue` narrows which task rows are eligible, with the same name and meaning as in `ox_health`; batching is unchanged. Schedule tick rows belong to no queue and are pruned as before. Closes oxpull#37 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
Same issue as #41: Verified locally:
|
…st it The flag narrows task rows only. The tick log is pruned for every schedule whatever --queue names, because deleting a task clears its ticks' link to it and an anchor never had one. The docs said ticks "belong to no queue and are pruned as usual", which hid that a run for one queue, or for a queue name with no rows, still deletes old ticks at its own cutoff. The configuration page and the changelog now say so, and a test pins it. The README's ox_prune table gains the --queue row it was missing, and test_queue_keeps_batching counts queries, so a single-statement delete no longer passes it.
Member
|
Thanks @burakeyler , merged. I pushed a small commit on top: the README's A few things that'll save a round next time:
and nice work! looking forward seeing you here again:) |
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.
Closes #37
What
ox_prunegains--queue, spelled and defaulted likeox_health --queue(default=None, "all queues"). When given, it addsqueue_name=<queue>to the task queryset before the batched delete loop, so it only narrows which rows are eligible —--batch-sizebehaves exactly as before. The output label names the queue (Deleted 3 SUCCESSFUL/DISCARDED (queue emails) task row(s) ...); without--queueoutput is unchanged.Schedule ticks:
OxScheduleTickhas no queue, so tick pruning is left as it is with or without--queue(anchors still kept). I documented that in the flag's row. If you'd rather--queueskip tick pruning entirely, that's a one-line change — happy to switch.Out of scope, per the issue: several queues in one invocation.
Tests
Three new tests in
tests/test_prune.py, each failing without the change:--dry-runcounts only that queue;--queuewith--batch-size 2still deletes every eligible row across batches.Gates (run locally, Windows, SQLite)
pytest -q tests/test_prune.py: 29 passed. Full suite: 1010 passed, 35 skipped, 3 failed — the 3 are intests/test_platform_signals.pyand fail identically on unmodifiedmainon Windows.ruff check .,ruff format --check .,mypy --strict src/,tools/check_release.py: pass.mkdocs build --strict, PostgreSQL/MySQL legs (this doesn't touch the claim path).Docs: new row in the
ox_prunetable indocs/configuration.md; CHANGELOG entry under Unreleased → Added. I didn't touch the generateddocs/llms-full.txt.🤖 Generated with Claude Code