@@ -297,7 +297,7 @@ impl CopyState {
297297 }
298298}
299299
300- pub ( crate ) fn source (
300+ pub ( crate ) async fn source (
301301 conn : & mut PgConnection ,
302302 dst : & Site ,
303303) -> Result < Option < DeploymentId > , StoreError > {
@@ -429,7 +429,7 @@ impl TableState {
429429 Ok ( states)
430430 }
431431
432- fn record_progress (
432+ async fn record_progress (
433433 & mut self ,
434434 conn : & mut PgConnection ,
435435 elapsed : Duration ,
@@ -466,7 +466,7 @@ impl TableState {
466466 Ok ( ( ) )
467467 }
468468
469- fn record_finished ( & self , conn : & mut PgConnection ) -> Result < ( ) , StoreError > {
469+ async fn record_finished ( & self , conn : & mut PgConnection ) -> Result < ( ) , StoreError > {
470470 use copy_table_state as cts;
471471
472472 update (
@@ -509,16 +509,20 @@ impl TableState {
509509
510510 deployment:: update_entity_count ( conn, & self . dst_site , count) . await ?;
511511
512- self . record_progress ( conn, duration) ?;
512+ self . record_progress ( conn, duration) . await ?;
513513
514514 if self . finished ( ) {
515- self . record_finished ( conn) ?;
515+ self . record_finished ( conn) . await ?;
516516 }
517517
518518 Ok ( Status :: Finished )
519519 }
520520
521- fn set_batch_size ( & mut self , conn : & mut PgConnection , size : usize ) -> Result < ( ) , StoreError > {
521+ async fn set_batch_size (
522+ & mut self ,
523+ conn : & mut PgConnection ,
524+ size : usize ,
525+ ) -> Result < ( ) , StoreError > {
522526 use copy_table_state as cts;
523527
524528 self . batcher . set_batch_size ( size) ;
@@ -835,10 +839,8 @@ impl CopyTableWorker {
835839 // that is hard to predict. This mechanism ensures
836840 // that if our estimation is wrong, the consequences
837841 // aren't too severe.
838- conn. transaction_async ( |conn| {
839- async { self . table . set_batch_size ( conn, 1 ) } . scope_boxed ( )
840- } )
841- . await ?;
842+ conn. transaction_async ( |conn| self . table . set_batch_size ( conn, 1 ) . scope_boxed ( ) )
843+ . await ?;
842844 }
843845 } ;
844846
0 commit comments