-
Notifications
You must be signed in to change notification settings - Fork 4
Remove completed one-time jobs from Scheduler._jobs_by_name #450
Copy link
Copy link
Open
Labels
area:schedulerScheduler serviceScheduler servicebugSomething isn't workingSomething isn't workingsize:smallQuick win, < 1 hourQuick win, < 1 hour
Milestone
Description
Description
One-time named jobs that complete naturally are removed from the SchedulerService heap but not from Scheduler._jobs_by_name. Re-scheduling with the same name raises ValueError, and if_exists="skip" returns a stale (completed, unqueued) job object.
Steps to Reproduce
- Schedule a named one-time job:
scheduler.run_once(func, delay=5, name="cleanup") - Wait for it to complete
- Schedule again with the same name:
scheduler.run_once(func, delay=5, name="cleanup") - Gets
ValueError: A job named 'cleanup' already exists
Expected Behavior
Completed one-time jobs should be removed from _jobs_by_name so the name can be reused.
Acceptance Criteria
- Completed one-time jobs are removed from
Scheduler._jobs_by_nameafter execution - Re-scheduling with the same name after completion works
-
if_exists="skip"does not return stale completed job objects - Existing tests pass; new test for name reuse after completion
Context
Found during post-execution challenge review of bus/scheduler hardening (#437, #412, #414, #436). Pre-existing issue, not introduced by the hardening changes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:schedulerScheduler serviceScheduler servicebugSomething isn't workingSomething isn't workingsize:smallQuick win, < 1 hourQuick win, < 1 hour
Projects
Status
Refinement