-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add priority to SHFlow, replace _flowPool with flat_set #1079
Merged
Conversation
This file contains 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
Check for duplicate wire scheduling in `_flowPool.insert`. If insertion fails due to an existing entry, log an error and throw an `SHException` with a descriptive message, ensuring wires are only scheduled once.
Introduce `setWirePriority` function and `priority` field to `SHWire` for controlling scheduling priority in the runtime. Update flow creation to pass priority and clamp the value within integer bounds. Modify `network.shs` tests to assign priorities, ensuring priority-based execution consistency across test cases.
This commit removes all `Priority` tags from various network test shards, including `network-test-server`, `client-init`, and `network-test-client` configurations. Adjustments ensure cleaner scheduling without explicit priority settings, enhancing maintainability and alignment with current shard practices.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #1079 +/- ##
==========================================
- Coverage 79.61% 79.60% -0.02%
==========================================
Files 358 358
Lines 61505 61438 -67
==========================================
- Hits 48968 48908 -60
+ Misses 12537 12530 -7 ☔ View full report in Codecov by Sentry. |
Refactor `SHFlow` structure initialization by adding a constructor with `priority`, `wire`, and `paused` arguments, and implement a less-than operator to handle priority-based sorting in `_flowPool`. Remove redundant `SHFlowLess` struct, streamline flow pool removal with improved iterator handling, and add trace logging for wire cleanup in `SHMesh`. Enhance serialization by adding `priority` to wire read/write operations and fix formatting in audio and genetic modules.
…ow swapping in mesh, and ensure resumption logic consistency This commit introduces improvements to `SHFlow` by encapsulating the paused state and wire pointer, allowing for getter and setter methods (`isPaused`, `setPaused`, `getWire`). Flow swapping logic is centralized in a new `swapFlows` function within `SHMesh`, ensuring consistent handling of flow priority and proper resumption behavior in cases where a resumer is set. This update also adjusts `SuspendWire` and `ResumeWire` to use the encapsulated paused state, and refactors logic in `wireCleanedUp` to manage flow removal accurately. Finally, `SwitchTo` updates `context->flow` using the mesh swap for better flow state management across ticks and wire transitions.
Refactor SHWire's event handling by centralizing dispatcher triggering within each wire instance instead of relying on the mesh. Add scoped connections for OnStart and OnCleanup events, enhancing safety and automatic disconnection upon destruction. Replace `scheduled` checks with direct removal from `_flowPool` during cleanup. Simplify `tick` function flow by updating iterator handling, removing unused flow state assertions, and eliminating redundant `wireCleanedUp` function from SHMesh. Refactor `Spawn` and `WhenDone` to handle cleanup connections using `scoped_connection` for safer lifecycle management.
Remove unnecessary `_connectedMesh` member and related checks in Spawn and WhenDone. Establish scoped connections for each `ManyWire` instance to handle cleanup events, reducing redundancy and ensuring that each wire has its own scoped connection.
Refactor `SHWire` to handle nested wire delegation with `childWire`, allowing `SwitchTo` operations to seamlessly transition control between wires. Add `tickingWire()` function to retrieve the active wire context, updating calls to `tick()` accordingly. Ensure proper child wire cleanup by resetting `childWire` and `resumer` pointers post-switch. Add validation and scheduling for non-started wires and enhance error logging for wire failures. Adjust logging and unscheduling logic to reflect expected `SwitchTo` behavior.
guusw
reviewed
Nov 12, 2024
- Update `SHWire` to use `uniqueId` for consistent ordering in `SHMesh` - Add `regenerateId` to ensure wires are added at the end of the mesh list - Modify `tickingWire` function to traverse nested `childWire` correctly - Add assertions in `WireDoppelgangerPool` for wire integrity checks - Include `allCleared` function in `SHMesh` to verify all containers are empty - Log wire creation and ensure ID regeneration
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.
No description provided.