@@ -2,21 +2,19 @@ use crate::{
22 db:: Pool ,
33 docbuilder:: Limits ,
44 impl_axum_webpage, impl_webpage,
5- utils:: { get_config, ConfigName } ,
5+ utils:: { get_config, spawn_blocking , ConfigName } ,
66 web:: {
77 error:: { AxumNope , WebResult } ,
88 page:: WebPage ,
99 } ,
1010} ;
11- use anyhow:: Context ;
1211use axum:: {
1312 extract:: { Extension , Path } ,
1413 response:: IntoResponse ,
1514} ;
1615use chrono:: { DateTime , TimeZone , Utc } ;
1716use iron:: { IronResult , Request as IronRequest , Response as IronResponse } ;
1817use serde:: Serialize ;
19- use tokio:: task:: spawn_blocking;
2018
2119/// sitemap index
2220#[ derive( Debug , Clone , PartialEq , Eq , Serialize ) ]
@@ -64,7 +62,7 @@ pub(crate) async fn sitemap_handler(
6462 return Err ( AxumNope :: ResourceNotFound ) ;
6563 }
6664 }
67- let releases = spawn_blocking ( move || -> anyhow :: Result < _ > {
65+ let releases = spawn_blocking ( move || {
6866 let mut conn = pool. get ( ) ?;
6967 let query = conn. query (
7068 "SELECT crates.name,
@@ -95,8 +93,7 @@ pub(crate) async fn sitemap_handler(
9593 } )
9694 . collect ( ) )
9795 } )
98- . await
99- . context ( "failed to join thread" ) ??;
96+ . await ?;
10097
10198 Ok ( SitemapXml { releases } )
10299}
@@ -116,12 +113,11 @@ impl_axum_webpage!(AboutBuilds = "core/about/builds.html");
116113pub ( crate ) async fn about_builds_handler (
117114 Extension ( pool) : Extension < Pool > ,
118115) -> WebResult < impl IntoResponse > {
119- let rustc_version = spawn_blocking ( move || -> anyhow :: Result < _ > {
116+ let rustc_version = spawn_blocking ( move || {
120117 let mut conn = pool. get ( ) ?;
121118 get_config :: < String > ( & mut conn, ConfigName :: RustcVersion )
122119 } )
123- . await
124- . context ( "failed to join thread" ) ??;
120+ . await ?;
125121
126122 Ok ( AboutBuilds {
127123 rustc_version,
0 commit comments