Skip to content

Commit

Permalink
do not target fixed sync period
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Apr 27, 2024
1 parent e4c24d8 commit 91189c5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/wallet/monero_wallet_full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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::milliseconds>(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);
}
}

Expand Down

0 comments on commit 91189c5

Please sign in to comment.