From 91189c5d013622ced87d89c3eea0d8cad00629a9 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 25 Apr 2024 19:09:29 -0400 Subject: [PATCH] do not target fixed sync period --- src/wallet/monero_wallet_full.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/wallet/monero_wallet_full.cpp b/src/wallet/monero_wallet_full.cpp index f367192c..9c707266 100644 --- a/src/wallet/monero_wallet_full.cpp +++ b/src/wallet/monero_wallet_full.cpp @@ -3810,7 +3810,6 @@ namespace monero { // sync while enabled while (m_syncing_enabled) { - auto start = std::chrono::system_clock::now(); try { lock_and_sync(); } catch (std::exception const& e) { std::cout << "monero_wallet_full failed to background synchronize: " << e.what() << std::endl; } catch (...) { std::cout << "monero_wallet_full failed to background synchronize" << std::endl; } @@ -3819,8 +3818,7 @@ namespace monero { if (m_syncing_enabled) { boost::mutex::scoped_lock lock(m_syncing_mutex); boost::posix_time::milliseconds wait_for_ms(m_syncing_interval.load()); - boost::posix_time::milliseconds elapsed_time = boost::posix_time::milliseconds(std::chrono::duration_cast(std::chrono::system_clock::now() - start).count()); - m_sync_cv.timed_wait(lock, elapsed_time > wait_for_ms ? boost::posix_time::milliseconds(0) : wait_for_ms - elapsed_time); // target regular sync period by accounting for sync time + m_sync_cv.timed_wait(lock, wait_for_ms); } }