@@ -19,7 +19,6 @@ use crate::types::{
1919const PROCESS_EVENTS_INTERVAL : Duration = Duration :: from_millis ( 1000 ) ;
2020const PEER_MANAGER_PING_INTERVAL : Duration = Duration :: from_secs ( 15 ) ;
2121const CHANNEL_MANAGER_TICK_INTERVAL : Duration = Duration :: from_secs ( 60 ) ;
22- const CHANNEL_MANAGER_POLL_INTERVAL : Duration = Duration :: from_millis ( 1000 ) ;
2322const NETWORK_GRAPH_INITIAL_DELAY : Duration = Duration :: from_secs ( 60 ) ;
2423const NETWORK_GRAPH_PRUNE_INTERVAL : Duration = Duration :: from_secs ( 15 * 60 ) ;
2524const PROB_SCORER_PERSIST_INTERVAL : Duration = Duration :: from_secs ( 5 * 60 ) ;
@@ -46,7 +45,6 @@ impl LexeBackgroundProcessor {
4645 let mut process_timer = interval ( PROCESS_EVENTS_INTERVAL ) ;
4746 let mut pm_timer = interval ( PEER_MANAGER_PING_INTERVAL ) ;
4847 let mut cm_tick_timer = interval ( CHANNEL_MANAGER_TICK_INTERVAL ) ;
49- let mut cm_poll_timer = interval ( CHANNEL_MANAGER_POLL_INTERVAL ) ;
5048 let start = Instant :: now ( ) + NETWORK_GRAPH_INITIAL_DELAY ;
5149 let mut ng_timer = interval_at ( start, NETWORK_GRAPH_PRUNE_INTERVAL ) ;
5250 let mut ps_timer = interval ( PROB_SCORER_PERSIST_INTERVAL ) ;
@@ -72,23 +70,19 @@ impl LexeBackgroundProcessor {
7270 }
7371
7472 // --- Persistence branches --- //
75- _ = cm_poll_timer. tick( ) => {
76- trace!( "Polling channel manager for updates" ) ;
77- let needs_persist = channel_manager
78- . get_persistence_condvar_value( ) ;
79- if needs_persist {
80- let persist_res = persister
81- . persist_manager( channel_manager. deref( ) )
82- . await ;
83- if let Err ( e) = persist_res {
84- // Failing to persist the channel manager won't
85- // lose funds so long as the chain monitors have
86- // been persisted correctly, but it's still
87- // serious - initiate a shutdown
88- error!( "Couldn't persist channel manager: {:#}" , e) ;
89- let _ = shutdown_tx. send( ( ) ) ;
90- break ;
91- }
73+ _ = channel_manager. get_persistable_update_future( ) => {
74+ debug!( "Persisting channel manager" ) ;
75+ let persist_res = persister
76+ . persist_manager( channel_manager. deref( ) )
77+ . await ;
78+ if let Err ( e) = persist_res {
79+ // Failing to persist the channel manager won't
80+ // lose funds so long as the chain monitors have
81+ // been persisted correctly, but it's still
82+ // serious - initiate a shutdown
83+ error!( "Couldn't persist channel manager: {:#}" , e) ;
84+ let _ = shutdown_tx. send( ( ) ) ;
85+ break ;
9286 }
9387 }
9488 _ = ng_timer. tick( ) => {
0 commit comments