Run dijkstra in the background#50
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements running the dijkstra algorithm in the background, ensuring that connecting two cities while the algorithm is busy will be dropped with an appropriate console message. Key changes include:
- Spawning a background thread to execute dijkstra and communicating via a channel.
- Refactoring state management for globe points to use Arc<RwLock<…>> for safe concurrent access.
- Updating system registration and function signatures to integrate the new background computation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/ui.rs | Adds background dijkstra execution and adjusts system chaining and globe points locking. |
| src/state.rs | Updates globe points to use Arc<RwLock> for concurrent access. |
Comments suppressed due to low confidence (2)
src/ui.rs:54
- The function name 'create_path_if_dijsktra_ready' appears to have a typo. Consider renaming it to 'create_path_if_dijkstra_ready' for consistency.
.add_systems(Update, create_path_if_dijsktra_ready)
src/ui.rs:468
- The variable 'dijksta_communication' is misspelled; renaming it to 'dijkstra_communication' would improve clarity and consistency with its type.
mut dijksta_communication: ResMut<DijkstraCommunication>,
papjuli
approved these changes
Jun 9, 2025
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.
Trying to connect two cities while dijkstra is running will be dropped (not completely silently, it will be printed on the console).