File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ use std::fmt::Debug;
77use std:: sync:: Arc ;
88use tracing:: trace;
99
10- #[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
1110use crate :: sync:: SyncType ;
1211use crate :: {
1312 config:: Config ,
@@ -250,16 +249,13 @@ impl FeatureProbe {
250249 syncer. start_sync ( self . config . start_wait , self . should_stop . clone ( ) ) ;
251250 }
252251
253- #[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
254252 pub fn sync_now ( & self , t : SyncType ) {
255253 trace ! ( "sync now url {}" , & self . config. toggles_url) ;
256254 let syncer = match & self . syncer {
257255 Some ( syncer) => syncer. clone ( ) ,
258256 None => return ,
259257 } ;
260- tokio:: spawn ( async move {
261- syncer. sync_now ( t) . await . expect ( "sync once error" ) ;
262- } ) ;
258+ syncer. sync_now ( t) ;
263259 }
264260
265261 #[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
@@ -314,7 +310,7 @@ impl FeatureProbe {
314310 trace ! ( "socket_on_update: {:?}" , payload) ;
315311 async move {
316312 if let Some ( syncer) = & slf. syncer {
317- let _ = syncer. sync_now ( SyncType :: Realtime ) . await ;
313+ let _ = syncer. sync_now ( SyncType :: Realtime ) ;
318314 } else {
319315 tracing:: warn!( "socket receive update event, but no synchronizer" ) ;
320316 }
Original file line number Diff line number Diff line change @@ -179,9 +179,15 @@ impl Synchronizer {
179179 None
180180 }
181181
182- #[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
183- pub async fn sync_now ( & self , t : SyncType ) -> Result < ( ) , FPError > {
184- self . inner . sync_now ( t) . await
182+ pub fn sync_now ( & self , t : SyncType ) {
183+ #[ cfg( feature = "use_tokio" ) ]
184+ {
185+ let slf = self . clone ( ) ;
186+ tokio:: spawn ( async move { slf. inner . sync_now ( t) . await } ) ;
187+ }
188+
189+ #[ cfg( feature = "use_std" ) ]
190+ let _ = self . inner . sync_now ( t) ;
185191 }
186192}
187193
You can’t perform that action at this time.
0 commit comments