Use #[tokio::main] attribute instead of Runtime::new() - #351
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the Tokio runtime usage by replacing manually created Runtime instances with the #[tokio::main] attribute in both modelardb_server and modelardb_manager. This change simplifies the async runtime management and eliminates the need to pass runtime instances between functions.
- Replaces manual
Runtime::new()creation with#[tokio::main]attribute - Converts synchronous main functions to async and removes
runtime.block_on()calls - Updates function signatures to be async where the runtime parameter was removed
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/modelardb_server/src/main.rs | Converts main function to async with #[tokio::main] and removes manual runtime creation |
| crates/modelardb_server/src/context.rs | Removes runtime parameter from Context::try_new() |
| crates/modelardb_server/src/storage/mod.rs | Moves runtime creation inside StorageEngine::try_new() instead of receiving it as parameter |
| crates/modelardb_server/src/remote.rs | Makes start_apache_arrow_flight_server() async and removes runtime parameter |
| crates/modelardb_server/src/storage/uncompressed_data_manager.rs | Removes runtime parameter from test context creation |
| crates/modelardb_server/src/configuration.rs | Removes runtime parameter from test storage engine creation |
| crates/modelardb_manager/src/main.rs | Converts main function to async with #[tokio::main] and removes manual runtime creation |
| crates/modelardb_manager/src/remote.rs | Makes start_apache_arrow_flight_server() async and removes runtime parameter |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
skejserjensen
approved these changes
Sep 25, 2025
chrthomsen
approved these changes
Sep 27, 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.
This PR removes the top-level Tokio runtime created with
Runtime::new()and instead uses the#[tokio::main]attribute in bothmodelardb_serverandmodelardb_manager.It was also attempted to remove the use of
thread::Builder::new().spawn()when creating the threads in the storage engine but it was not possible to find a solution that did not block the thread or cause problems with the async runtime.It might be possible if we used async Tokio channels instead of
crossbeam_channelsince the current channels are blocking but that would require a larger change to the structure of the storage engine.