@@ -645,10 +645,14 @@ cfg_sync! {
645645 let mut bg_abort: Option <std:: sync:: Arc <crate :: sync:: DropAbort >> = None ;
646646
647647 if let Some ( sync_interval) = sync_interval {
648+ let sync_span = tracing:: debug_span!( "sync_interval" ) ;
649+ let _enter = sync_span. enter( ) ;
650+
648651 let sync_ctx = db. sync_ctx. as_ref( ) . unwrap( ) . clone( ) ;
649652 {
650653 let mut ctx = sync_ctx. lock( ) . await ;
651654 crate :: sync:: bootstrap_db( & mut ctx) . await ?;
655+ tracing:: debug!( "finished bootstrap with sync interval" ) ;
652656 }
653657
654658 // db.connect creates a local db file, so it is important that we always call
@@ -657,8 +661,13 @@ cfg_sync! {
657661 let conn = db. connect( ) ?;
658662 let jh = tokio:: spawn(
659663 async move {
664+ let mut interval = tokio:: time:: interval( sync_interval) ;
665+
660666 loop {
661- tracing:: trace!( "trying to sync" ) ;
667+ tracing:: info!( "trying to sync" ) ;
668+
669+ interval. tick( ) . await ;
670+
662671 let mut ctx = sync_ctx. lock( ) . await ;
663672 if remote_writes {
664673 if let Err ( e) = crate :: sync:: try_pull( & mut ctx, & conn) . await {
@@ -669,10 +678,9 @@ cfg_sync! {
669678 tracing:: error!( "sync error: {}" , e) ;
670679 }
671680 }
672- tokio:: time:: sleep( sync_interval) . await ;
673681 }
674682 }
675- . instrument( tracing:: info_span !( "sync_interval " ) ) ,
683+ . instrument( tracing:: debug_span !( "sync interval thread " ) ) ,
676684 ) ;
677685
678686 bg_abort. replace( std:: sync:: Arc :: new( crate :: sync:: DropAbort ( jh. abort_handle( ) ) ) ) ;
0 commit comments