set dbpool thread name (gated by tokio_unstable)

Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
Jason Volk 2024-12-17 14:51:21 +00:00 committed by strawberry
parent f78104a959
commit 5f7636f177
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View file

@ -242,6 +242,7 @@ features = [
"time",
"rt-multi-thread",
"io-util",
"tracing",
]
[workspace.dependencies.tokio-metrics]

View file

@ -122,8 +122,16 @@ async fn spawn_until(self: &Arc<Self>, recv: Receiver<Cmd>, max: usize) -> Resul
fn spawn_one(self: &Arc<Self>, workers: &mut JoinSet<()>, recv: Receiver<Cmd>) -> Result {
let id = workers.len();
let self_ = self.clone();
#[cfg(not(tokio_unstable))]
let _abort = workers.spawn_blocking_on(move || self_.worker(id, recv), self.server.runtime());
#[cfg(tokio_unstable)]
let _abort = workers
.build_task()
.name("conduwuit:dbpool")
.spawn_blocking_on(move || self_.worker(id, recv), self.server.runtime());
Ok(())
}