Fix overflow in StorageWindowView

This commit is contained in:
Michael Kolupaev 2024-06-25 02:52:42 +00:00
parent bebed0598d
commit d66aedf3db

View File

@ -1068,9 +1068,10 @@ void StorageWindowView::threadFuncFireProc()
if (max_watermark >= timestamp_now)
clean_cache_task->schedule();
UInt64 next_fire_ms = static_cast<UInt64>(next_fire_signal) * 1000;
UInt64 timestamp_ms = static_cast<UInt64>(Poco::Timestamp().epochMicroseconds()) / 1000;
if (!shutdown_called)
fire_task->scheduleAfter(std::max(UInt64(0), static_cast<UInt64>(next_fire_signal) * 1000 - timestamp_ms));
fire_task->scheduleAfter(std::max(UInt64(0), next_fire_ms - std::min(next_fire_ms, timestamp_ms)));
}
void StorageWindowView::threadFuncFireEvent()