atomic backoff_end_time added

This commit is contained in:
Nikita Mikhaylov 2020-01-31 14:10:34 +03:00
parent b19f76df01
commit 8715841291
2 changed files with 3 additions and 3 deletions

View File

@ -821,7 +821,7 @@ void CacheDictionary::update(BunchUpdateUnit & bunch_update_unit) const
const auto now = std::chrono::system_clock::now();
if (now > backoff_end_time)
if (now > backoff_end_time.load())
{
try
{
@ -902,7 +902,7 @@ void CacheDictionary::update(BunchUpdateUnit & bunch_update_unit) const
backoff_end_time = now + std::chrono::seconds(calculateDurationWithBackoff(rnd_engine, error_count));
tryLogException(last_exception, log, "Could not update cache dictionary '" + getFullName() +
"', next update is scheduled at " + ext::to_string(backoff_end_time));
"', next update is scheduled at " + ext::to_string(backoff_end_time.load()));
}
}

View File

@ -318,7 +318,7 @@ private:
mutable std::exception_ptr last_exception;
mutable std::atomic<size_t> error_count = 0;
mutable std::chrono::system_clock::time_point backoff_end_time;
mutable std::atomic<std::chrono::system_clock::time_point> backoff_end_time;
mutable pcg64 rnd_engine;