File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change 1- use crate :: tasks:: spawn_blocking;
21use crate :: worker:: Environment ;
32use crates_io_worker:: BackgroundJob ;
4- use diesel:: { sql_query, RunQueryDsl } ;
5- use diesel_async:: async_connection_wrapper :: AsyncConnectionWrapper ;
3+ use diesel:: sql_query;
4+ use diesel_async:: RunQueryDsl ;
65use std:: sync:: Arc ;
76
87#[ derive( Serialize , Deserialize ) ]
@@ -24,15 +23,13 @@ impl BackgroundJob for DailyDbMaintenance {
2423 /// archive daily download counts and drop historical data, we can drop this task and rely on
2524 /// auto-vacuum again.
2625 async fn run ( & self , env : Self :: Context ) -> anyhow:: Result < ( ) > {
27- let conn = env. deadpool . get ( ) . await ?;
28- spawn_blocking ( move || {
29- let conn: & mut AsyncConnectionWrapper < _ > = & mut conn. into ( ) ;
26+ let mut conn = env. deadpool . get ( ) . await ?;
3027
31- info ! ( "Running VACUUM on version_downloads table" ) ;
32- sql_query ( "VACUUM version_downloads;" ) . execute ( conn ) ? ;
33- info ! ( "Finished running VACUUM on version_downloads table" ) ;
34- Ok ( ( ) )
35- } )
36- . await
28+ info ! ( "Running VACUUM on version_downloads table" ) ;
29+ sql_query ( "VACUUM version_downloads;" )
30+ . execute ( & mut conn )
31+ . await ? ;
32+ info ! ( "Finished running VACUUM on version_downloads table" ) ;
33+ Ok ( ( ) )
3734 }
3835}
You can’t perform that action at this time.
0 commit comments