Skip to content

Run dijkstra in the background#50

Merged
lukacslacko merged 5 commits into
mainfrom
dijkstra-thread
Jun 9, 2025
Merged

Run dijkstra in the background#50
lukacslacko merged 5 commits into
mainfrom
dijkstra-thread

Conversation

@lukacslacko

Copy link
Copy Markdown
Owner

Trying to connect two cities while dijkstra is running will be dropped (not completely silently, it will be printed on the console).

@lukacslacko lukacslacko requested review from Copilot and papjuli June 9, 2025 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>,

Comment thread src/ui.rs Outdated
Comment thread src/ui.rs Outdated
@lukacslacko lukacslacko merged commit f024778 into main Jun 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants