@@ -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 {
@@ -307,12 +313,16 @@ impl BackgroundProcessor {
307
313
} else {
308
314
log_trace ! ( logger, "Not pruning network graph, either due to pending rapid gossip sync or absence of a prunable graph." ) ;
309
315
}
316
+ }
317
+
318
+ if last_scorer_persist_call. elapsed ( ) . as_secs ( ) > SCORER_PERSIST_TIMER {
310
319
if let Some ( ref scorer) = scorer {
311
320
log_trace ! ( logger, "Persisting scorer" ) ;
312
321
if let Err ( e) = persister. persist_scorer ( & scorer) {
313
322
log_error ! ( logger, "Error: Failed to persist scorer, check your disk and permissions {}" , e)
314
323
}
315
324
}
325
+ last_scorer_persist_call = Instant :: now ( ) ;
316
326
}
317
327
}
318
328
0 commit comments