Skip to content

Commit e4c879b

Browse files
committed
use runtime.spawn instead of thread::spawn
1 parent a5ab40c commit e4c879b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/web/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,14 @@ pub fn start_background_metrics_webserver(
326326
let metrics_axum_app = build_metrics_axum_app(context)?.into_make_service();
327327
let runtime = context.runtime()?;
328328

329-
thread::spawn(move || {
330-
runtime.block_on(async {
331-
if let Err(err) = axum::Server::bind(&axum_addr)
332-
.serve(metrics_axum_app)
333-
.await
334-
.context("error running metrics web server")
335-
{
336-
report_error(&err);
337-
}
338-
})
329+
runtime.spawn(async move {
330+
if let Err(err) = axum::Server::bind(&axum_addr)
331+
.serve(metrics_axum_app)
332+
.await
333+
.context("error running metrics web server")
334+
{
335+
report_error(&err);
336+
}
339337
});
340338

341339
Ok(())

0 commit comments

Comments
 (0)