@@ -536,26 +536,6 @@ pub(crate) async fn sites_task(
536536 typeinfos: typeinfos. clone( )
537537 } ;
538538
539- let mut online_status_workers = Vec :: new( ) ;
540- for ( site, info) in sites_info. iter( ) {
541- if app_state. app_closing. load( std:: sync:: atomic:: Ordering :: Relaxed ) {
542- break ;
543- }
544-
545- if sub_hps. get( & info. sub_hp) . is_none_or( |sub_hp| matches!( sub_hp, SubHpInfo :: PushLog ) ) {
546- continue
547- } ;
548- let ( tx, rx) = futures:: channel:: mpsc:: unbounded( ) ;
549- online_status_channels. insert( site. to_string( ) , tx) ;
550- online_status_workers. push( online_status_worker( site. clone( ) , rx, client_cmd_tx. clone( ) , app_state. clone( ) ) ) ;
551- }
552- online_status_task = Some ( tokio:: spawn( async move {
553- debug!( target: "OnlineStatus" , "online status task starts" ) ;
554- futures:: future:: join_all( online_status_workers) . await ;
555- debug!( target: "OnlineStatus" , "online status task finish" ) ;
556- } ) ) ;
557- * app_state. online_states. write( ) . await = sites_info. keys( ) . map( |site| ( site. clone( ) , Default :: default ( ) ) ) . collect( ) ;
558-
559539 let params = shvrpc:: journalrw:: GetLog2Params {
560540 since: shvrpc:: journalrw:: GetLog2Since :: LastEntry ,
561541 with_snapshot: true ,
@@ -596,6 +576,26 @@ pub(crate) async fn sites_task(
596576 * app_state. alarms. write( ) . await = alarms;
597577 * app_state. state_alarms. write( ) . await = state_alarms;
598578
579+ let mut online_status_workers = Vec :: new( ) ;
580+ for ( site, info) in sites_info. iter( ) {
581+ if app_state. app_closing. load( std:: sync:: atomic:: Ordering :: Relaxed ) {
582+ break ;
583+ }
584+
585+ if sub_hps. get( & info. sub_hp) . is_none_or( |sub_hp| matches!( sub_hp, SubHpInfo :: PushLog ) ) {
586+ continue
587+ } ;
588+ let ( tx, rx) = futures:: channel:: mpsc:: unbounded( ) ;
589+ online_status_channels. insert( site. to_string( ) , tx) ;
590+ online_status_workers. push( online_status_worker( site. clone( ) , rx, client_cmd_tx. clone( ) , app_state. clone( ) ) ) ;
591+ }
592+ online_status_task = Some ( tokio:: spawn( async move {
593+ debug!( target: "OnlineStatus" , "online status task starts" ) ;
594+ futures:: future:: join_all( online_status_workers) . await ;
595+ debug!( target: "OnlineStatus" , "online status task finish" ) ;
596+ } ) ) ;
597+ * app_state. online_states. write( ) . await = sites_info. keys( ) . map( |site| ( site. clone( ) , Default :: default ( ) ) ) . collect( ) ;
598+
599599 periodic_sync_tx
600600 . unbounded_send( PeriodicSyncCommand :: Enable )
601601 . unwrap_or_else( |e| log:: error!( "Cannot send periodic sync enable command: {e}" ) ) ;
0 commit comments