Skip to content

Queue Improvements - #67

Open
ronfriedhaber wants to merge 1 commit into
DecartAI:mainfrom
ronfriedhaber:main
Open

Queue Improvements#67
ronfriedhaber wants to merge 1 commit into
DecartAI:mainfrom
ronfriedhaber:main

Conversation

@ronfriedhaber

@ronfriedhaber ronfriedhaber commented Aug 31, 2026

Copy link
Copy Markdown
  • Persevere caller's options, results in safer implementation memory-reference wise
  • Notify status change solely when status (state) differs
  • Support cancel token for async termination

Note

Low Risk
Localized queue client behavior changes with tests; cancellation is opt-in and does not alter default submit/poll semantics.

Overview
submit_and_poll now copies the caller’s options dict before popping on_status_change, so the original mapping is not mutated in place.

Polling can be stopped cooperatively via an optional cancel_token (asyncio.Event). A new _wait_or_cancel helper replaces fixed asyncio.sleep during the initial delay and between status checks; if the token is set, polling raises asyncio.CancelledError (including before submit when the token is already set).

on_status_change is invoked only when the job status string actually changes, while still firing once for the initial post-submit status.

Tests tighten the status-callback sequence expectations, assert the caller’s options dict is preserved, and add coverage for cancellation before submit.

Reviewed by Cursor Bugbot for commit 1aeb2d4. Bugbot is set up for automated code reviews on this repo. Configure here.

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