Fix error_count in case of distributed_directory_monitor_max_sleep_time_ms>5min

In this case the error counter will be decremented everytime.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-12-04 16:01:32 +01:00
parent 8c69c14d4a
commit 638d0102f8

View File

@ -218,6 +218,15 @@ void DistributedAsyncInsertDirectoryQueue::run()
/// No errors while processing existing files.
/// Let's see maybe there are more files to process.
do_sleep = false;
const auto now = std::chrono::system_clock::now();
if (now - last_decrease_time > decrease_error_count_period)
{
std::lock_guard status_lock(status_mutex);
status.error_count /= 2;
last_decrease_time = now;
}
}
catch (...)
{
@ -236,15 +245,6 @@ void DistributedAsyncInsertDirectoryQueue::run()
else
LOG_TEST(LogFrequencyLimiter(log, 30), "Skipping send data over distributed table.");
const auto now = std::chrono::system_clock::now();
if (now - last_decrease_time > decrease_error_count_period)
{
std::lock_guard status_lock(status_mutex);
status.error_count /= 2;
last_decrease_time = now;
}
if (do_sleep)
break;
}