mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 20:42:04 +00:00
fix: quota limit was not reached, but the limit was exceeded
This commit is contained in:
parent
99cbf64044
commit
7b88c956c8
@ -52,9 +52,7 @@ struct EnabledQuota::Impl
|
|||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// We reset counters only if the interval's end has been calculated before.
|
bool need_reset_counters = false;
|
||||||
/// If it hasn't we just calculate the interval's end for the first time and don't reset counters yet.
|
|
||||||
bool need_reset_counters = (end_loaded.count() != 0);
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -66,7 +64,12 @@ struct EnabledQuota::Impl
|
|||||||
UInt64 n = static_cast<UInt64>((current_time - end + duration) / duration);
|
UInt64 n = static_cast<UInt64>((current_time - end + duration) / duration);
|
||||||
end = end + duration * n;
|
end = end + duration * n;
|
||||||
if (end_of_interval.compare_exchange_strong(end_loaded, end.time_since_epoch()))
|
if (end_of_interval.compare_exchange_strong(end_loaded, end.time_since_epoch()))
|
||||||
|
{
|
||||||
|
/// We reset counters only if the interval's end has been calculated before.
|
||||||
|
/// If it hasn't we just calculate the interval's end for the first time and don't reset counters yet.
|
||||||
|
need_reset_counters = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
end = std::chrono::system_clock::time_point{end_loaded};
|
end = std::chrono::system_clock::time_point{end_loaded};
|
||||||
}
|
}
|
||||||
while (current_time >= end);
|
while (current_time >= end);
|
||||||
|
Loading…
Reference in New Issue
Block a user