File tree 2 files changed +11
-9
lines changed
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;
7
7
use std:: sync:: Arc ;
8
8
use tracing:: trace;
9
9
10
- #[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
11
10
use crate :: sync:: SyncType ;
12
11
use crate :: {
13
12
config:: Config ,
@@ -250,16 +249,13 @@ impl FeatureProbe {
250
249
syncer. start_sync ( self . config . start_wait , self . should_stop . clone ( ) ) ;
251
250
}
252
251
253
- #[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
254
252
pub fn sync_now ( & self , t : SyncType ) {
255
253
trace ! ( "sync now url {}" , & self . config. toggles_url) ;
256
254
let syncer = match & self . syncer {
257
255
Some ( syncer) => syncer. clone ( ) ,
258
256
None => return ,
259
257
} ;
260
- tokio:: spawn ( async move {
261
- syncer. sync_now ( t) . await . expect ( "sync once error" ) ;
262
- } ) ;
258
+ syncer. sync_now ( t) ;
263
259
}
264
260
265
261
#[ cfg( all( feature = "use_tokio" , feature = "realtime" ) ) ]
@@ -314,7 +310,7 @@ impl FeatureProbe {
314
310
trace ! ( "socket_on_update: {:?}" , payload) ;
315
311
async move {
316
312
if let Some ( syncer) = & slf. syncer {
317
- let _ = syncer. sync_now ( SyncType :: Realtime ) . await ;
313
+ let _ = syncer. sync_now ( SyncType :: Realtime ) ;
318
314
} else {
319
315
tracing:: warn!( "socket receive update event, but no synchronizer" ) ;
320
316
}
Original file line number Diff line number Diff line change @@ -179,9 +179,15 @@ impl Synchronizer {
179
179
None
180
180
}
181
181
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) ;
185
191
}
186
192
}
187
193
You can’t perform that action at this time.
0 commit comments