Conversation
refresh_waiting_tasks() forced consumers to understand when BPMN internals needed WAITING tasks refreshed. Because the method scanned waiting tasks and timers, consumers had to call it defensively, making it both a leaky abstraction and a performance trap for hot-path runners. Keep the public BpmnWorkflow.refresh_waiting_tasks() method as a compatibility no-op and move refresh behavior into engine-owned paths: index WAITING tasks as states change, prune removed tasks, refresh structural waits from task completion notifications, refresh matched event catches directly, schedule timer waits by due time, and rebuild the private index after deserialization. Add generated BPMN stress fixtures and a Makefile target for repeatable measurement: make RUN='uv run' waiting-task-stress. Stress results with 100 dormant timers and 100 ready hot-path steps: ready hot path dropped from 10,300 to 100 timer checks (103x fewer), and staggered timers dropped from 1,900 to 10 timer checks (190x fewer). Final stress elapsed times were about 0.092s and 0.0044s respectively. Verified with: make RUN='uv run' tests; make RUN='uv run' waiting-task-stress.
Contributor
|
Well, I never liked refresh waiting tasks either. This is somewhat more complicated than it needs to be and I don't like the attribute checks in workflow (I've worked hard to separate bpmn functionality from the core functionality) but whatever. |
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.
refresh_waiting_tasks() forced consumers to understand when BPMN internals needed WAITING tasks refreshed. Because the method scanned waiting tasks and timers, consumers had to call it defensively, making it both a leaky abstraction and a performance trap for hot-path runners.
Keep the public BpmnWorkflow.refresh_waiting_tasks() method as a compatibility no-op and move refresh behavior into engine-owned paths: index WAITING tasks as states change, prune removed tasks, refresh structural waits from task completion notifications, refresh matched event catches directly, schedule timer waits by due time, and rebuild the private index after deserialization.
Add generated BPMN stress fixtures and a Makefile target for repeatable measurement: make RUN='uv run' waiting-task-stress.
Stress results with 100 dormant timers and 100 ready hot-path steps: ready hot path dropped from 10,300 to 100 timer checks (103x fewer), and staggered timers dropped from 1,900 to 10 timer checks (190x fewer). Final stress elapsed times were about 0.092s and 0.0044s respectively.
Verified with: make RUN='uv run' tests; make RUN='uv run' waiting-task-stress.