feat: allow multi-thread worker with feature flag

This commit is contained in:
əlemi 2024-12-05 03:16:50 +01:00
parent df52674e3d
commit 1da003dc28
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 14 additions and 1 deletions

View file

@ -19,3 +19,4 @@ async-recursion = "1.1.1"
[features]
default = []
bundled = ["rusqlite/bundled"]
multi-thread = ["tokio/rt-multi-thread", "tokio/time"]

View file

@ -50,7 +50,19 @@ fn main() {
},
};
if let Err(e) = tokio::runtime::Builder::new_current_thread()
let mut runtime_builder = {
#[cfg(feature = "multi-thread")]
{
tokio::runtime::Builder::new_multi_thread()
}
#[cfg(not(feature = "multi-thread"))]
{
tokio::runtime::Builder::new_current_thread()
}
};
if let Err(e) = runtime_builder
.enable_all()
.build()
.expect("could not create tokio runtime")