@@ -176,12 +176,8 @@ impl BuildQueue {
176176 } )
177177 }
178178
179- pub ( crate ) async fn has_build_queued (
180- & self ,
181- conn : & mut sqlx:: PgConnection ,
182- name : & str ,
183- version : & str ,
184- ) -> Result < bool > {
179+ pub ( crate ) async fn has_build_queued ( & self , name : & str , version : & str ) -> Result < bool > {
180+ let mut conn = self . db . get_async ( ) . await ?;
185181 Ok ( sqlx:: query_scalar!(
186182 "SELECT id
187183 FROM queue
@@ -501,7 +497,7 @@ impl BuildQueue {
501497 update_latest_version_id ( & mut * conn, crate_id) . await ?;
502498 } else {
503499 match self
504- . has_build_queued ( & mut * conn , name, version)
500+ . has_build_queued ( name, version)
505501 . await
506502 . context ( "error trying to fetch build queue" )
507503 {
@@ -678,20 +674,14 @@ mod tests {
678674 queue. add_crate ( "dummy" , "0.1.1" , 0 , None ) ?;
679675 env. runtime ( ) . block_on ( async {
680676 let mut conn = env. async_db ( ) . await . async_conn ( ) . await ;
681- assert ! ( queue
682- . has_build_queued( & mut conn, "dummy" , "0.1.1" )
683- . await
684- . unwrap( ) ) ;
677+ assert ! ( queue. has_build_queued( "dummy" , "0.1.1" ) . await . unwrap( ) ) ;
685678
686679 sqlx:: query!( "UPDATE queue SET attempt = 6" )
687680 . execute ( & mut * conn)
688681 . await
689682 . unwrap ( ) ;
690683
691- assert ! ( !queue
692- . has_build_queued( & mut conn, "dummy" , "0.1.1" )
693- . await
694- . unwrap( ) ) ;
684+ assert ! ( !queue. has_build_queued( "dummy" , "0.1.1" ) . await . unwrap( ) ) ;
695685 } ) ;
696686
697687 Ok ( ( ) )
0 commit comments