Fix distributed send retries on distributed_directory_monitor_{max_,}sleep_time_ms > 5min

In this case error_count can be decreased before checking it for
rescheduling send.

And actually this can be a problem not only when
distributed_directory_monitor_{max_,}sleep_time_ms > 5min, because all
threads can be occupated and the real timeout between sends will be > 5min.
This commit is contained in:
Azat Khuzhin 2020-05-10 12:32:51 +03:00
parent 14fccf572f
commit 5c89cdbe61

View File

@ -131,9 +131,10 @@ void StorageDistributedDirectoryMonitor::run()
{
std::unique_lock lock{mutex};
bool do_sleep = false;
while (!quit)
{
bool do_sleep = true;
do_sleep = true;
if (!monitor_blocker.isCancelled())
{
try
@ -166,7 +167,7 @@ void StorageDistributedDirectoryMonitor::run()
break;
}
if (!quit && error_count)
if (!quit && do_sleep)
task_handle->scheduleAfter(sleep_time.count());
}