sync period defined as long in milliseconds

This commit is contained in:
woodser
2020-12-21 15:05:20 -05:00
parent 0bc51f525b
commit dd610d0879
3 changed files with 7 additions and 13 deletions
+3 -3
View File
@@ -460,11 +460,11 @@ namespace monero {
}
/**
* Start background synchronizing with a maximum number of seconds between syncs.
* Start background synchronizing with a maximum period between syncs.
*
* @param sync_rate_in_seconds - maximum number of seconds between wallet syncs for updates (default 10 seconds)
* @param syncPeriodInMs - maximum period between syncs in milliseconds
*/
virtual void start_syncing(uint32_t sync_rate_in_seconds = 10) {
virtual void start_syncing(uint64_t sync_period_in_ms = 10000) {
throw std::runtime_error("start_syncing() not supported");
}
+3 -9
View File
@@ -1372,21 +1372,15 @@ namespace monero {
return result;
}
/**
* Start automatic syncing as its own thread.
*/
void monero_wallet_core::start_syncing(uint32_t sync_rate_in_seconds) {
void monero_wallet_core::start_syncing(uint64_t sync_period_in_ms) {
if (!m_is_connected) throw std::runtime_error("Wallet is not connected to daemon");
m_syncing_interval = sync_rate_in_seconds * 1000; // set sync rate // TODO: use ms instead of seconds?
m_syncing_interval = sync_period_in_ms;
if (!m_syncing_enabled) {
m_syncing_enabled = true;
run_sync_loop(); // sync wallet on loop in background
run_sync_loop(); // sync wallet on loop in background
}
}
/**
* Stop automatic syncing as its own thread.
*/
void monero_wallet_core::stop_syncing() {
m_syncing_enabled = false;
m_w2->stop();
+1 -1
View File
@@ -204,7 +204,7 @@ namespace monero {
monero_sync_result sync(monero_wallet_listener& listener) override;
monero_sync_result sync(uint64_t start_height) override;
monero_sync_result sync(uint64_t start_height, monero_wallet_listener& listener) override;
void start_syncing(uint32_t sync_rate) override;
void start_syncing(uint64_t sync_period_in_ms) override;
void stop_syncing() override;
void rescan_spent() override;
void rescan_blockchain() override;