gui(cache): store last poll at startup
This commit is contained in:
parent
acf14c6d73
commit
92a4a4f8dc
@ -10,7 +10,10 @@ pub struct Cache {
|
||||
pub coins: Vec<Coin>,
|
||||
pub rescan_progress: Option<f64>,
|
||||
pub sync_progress: f64,
|
||||
/// The most recent `last_poll_timestamp`.
|
||||
pub last_poll_timestamp: Option<u32>,
|
||||
/// The `last_poll_timestamp` when starting the application.
|
||||
pub last_poll_at_startup: Option<u32>,
|
||||
}
|
||||
|
||||
/// only used for tests.
|
||||
@ -24,6 +27,7 @@ impl std::default::Default for Cache {
|
||||
rescan_progress: None,
|
||||
sync_progress: 1.0,
|
||||
last_poll_timestamp: None,
|
||||
last_poll_at_startup: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,6 +284,7 @@ impl App {
|
||||
let daemon = self.daemon.clone();
|
||||
let datadir_path = self.cache.datadir_path.clone();
|
||||
let network = self.cache.network;
|
||||
let last_poll_at_startup = self.cache.last_poll_at_startup;
|
||||
Command::perform(
|
||||
async move {
|
||||
// we check every 10 second if the daemon poller is alive
|
||||
@ -302,6 +303,7 @@ impl App {
|
||||
rescan_progress: info.rescan_progress,
|
||||
sync_progress: info.sync,
|
||||
last_poll_timestamp: info.last_poll_timestamp,
|
||||
last_poll_at_startup, // doesn't change
|
||||
})
|
||||
},
|
||||
Message::UpdateCache,
|
||||
|
||||
@ -407,7 +407,9 @@ pub async fn load_application(
|
||||
blockheight: info.block_height,
|
||||
coins,
|
||||
sync_progress: info.sync,
|
||||
// Both last poll fields start with the same value.
|
||||
last_poll_timestamp: info.last_poll_timestamp,
|
||||
last_poll_at_startup: info.last_poll_timestamp,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@ -462,7 +462,9 @@ pub fn create_app_with_remote_backend(
|
||||
sync_progress: 1.0, // Remote backend is always synced
|
||||
datadir_path: datadir.clone(),
|
||||
blockheight: wallet.tip_height.unwrap_or(0),
|
||||
last_poll_timestamp: None, // We ignore this field for remote backend.
|
||||
// We ignore last poll fields for remote backend.
|
||||
last_poll_timestamp: None,
|
||||
last_poll_at_startup: None,
|
||||
},
|
||||
Arc::new(
|
||||
Wallet::new(wallet.descriptor)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user