-
Notifications
You must be signed in to change notification settings - Fork 179
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
refactor(torii): different tasks for torii services #2552
Conversation
WalkthroughOhayo! This pull request modifies the Changes
Possibly related PRs
Suggested reviewers
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
bin/torii/src/main.rs (1)
311-324
: Ohayo, sensei! Great job on improving concurrency!The changes to spawn separate tasks for each server component are a significant improvement. This approach allows for better concurrency and potentially improved performance. The separation of concerns is also cleaner now.
However, there are a few points to consider:
Error handling: The current implementation uses
??
to propagate errors. Consider adding more robust error handling for each task.Resource management: With concurrent execution, be mindful of potential increased resource usage. You might want to add some resource limiting mechanisms if needed.
Shutdown coordination: Ensure that all tasks shut down gracefully when the main select block exits.
Here's a suggestion to improve error handling:
- let engine_handle = tokio::spawn(async move { engine.start().await }); + let engine_handle = tokio::spawn(async move { + if let Err(e) = engine.start().await { + error!(target: LOG_TARGET, error = %e, "Engine encountered an error"); + } + });Apply similar changes to other task spawns for consistent error handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be interesting to consider https://github.com/dojoengine/dojo/blob/main/crates/katana/tasks/src/manager.rs in a future rework on this part. 👍
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2552 +/- ##
==========================================
- Coverage 69.55% 69.53% -0.03%
==========================================
Files 388 388
Lines 49964 49971 +7
==========================================
- Hits 34752 34746 -6
- Misses 15212 15225 +13 ☔ View full report in Codecov by Sentry. |
Summary by CodeRabbit
New Features
Bug Fixes