fix: prevent task.next event loop on todo task updates#23
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The prior commit edited an existing migration in-place, which won't apply to databases that already ran it (SQLx tracks checksums). Revert the original migration and add a new one that drops/recreates the trigger with the OLD.status != 'todo' guard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Fix task.next event loop on todo task updates
Workers subscribing to
task.nextevents experienced an event loop where the same task would emit repeatedtask.nextevents approximately every second. This caused unnecessary event spam and wasted runner capacity.Root cause: The
trg_task_next_on_status_todotrigger fired on any update to a task withstatus = 'todo', not just on transitions totodo. When a worker claimed a task (settingowner,worker_ids, etc.), the update triggered anothertask.nextevent, which the daemon dispatched back to a worker, creating an infinite loop at the poll interval.What changed:
AND OLD.status != 'todo'guard totrg_task_next_on_status_todo, so it only fires on actual status transitions totodo— not on metadata updates to tasks already intodostatustask.next✻ Clauded...