@@ -79,6 +79,11 @@ const PING_TIMER: u64 = 1;
79
79
/// Prune the network graph of stale entries hourly.
80
80
const NETWORK_PRUNE_TIMER : u64 = 60 * 60 ;
81
81
82
+ #[ cfg( all( not( test) , debug_assertions) ) ]
83
+ const SCORER_PERSIST_TIMER : u64 = 30 ;
84
+ #[ cfg( test) ]
85
+ const SCORER_PERSIST_TIMER : u64 = 1 ;
86
+
82
87
#[ cfg( not( test) ) ]
83
88
const FIRST_NETWORK_PRUNE_TIMER : u64 = 60 ;
84
89
#[ cfg( test) ]
@@ -214,6 +219,7 @@ impl BackgroundProcessor {
214
219
let mut last_freshness_call = Instant :: now ( ) ;
215
220
let mut last_ping_call = Instant :: now ( ) ;
216
221
let mut last_prune_call = Instant :: now ( ) ;
222
+ let mut last_scorer_persist_call = Instant :: now ( ) ;
217
223
let mut have_pruned = false ;
218
224
219
225
loop {
@@ -305,12 +311,16 @@ impl BackgroundProcessor {
305
311
log_trace ! ( logger, "Not pruning network graph due to pending gossip sync" ) ;
306
312
}
307
313
}
314
+ }
315
+
316
+ if last_scorer_persist_call. elapsed ( ) . as_secs ( ) > SCORER_PERSIST_TIMER {
308
317
if let Some ( ref scorer) = scorer {
309
318
log_trace ! ( logger, "Persisting scorer" ) ;
310
319
if let Err ( e) = persister. persist_scorer ( & scorer) {
311
320
log_error ! ( logger, "Error: Failed to persist scorer, check your disk and permissions {}" , e)
312
321
}
313
322
}
323
+ last_scorer_persist_call = Instant :: now ( ) ;
314
324
}
315
325
}
316
326
0 commit comments