Merge pull request #56500 from kitaisreal/function-sleep-exception-message-fix

FunctionSleep exception message fix
This commit is contained in:
Nikolai Kochetov 2023-11-10 12:30:18 +01:00 committed by GitHub
commit 145468dfd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,13 +112,15 @@ public:
if (size > 0) if (size > 0)
{ {
/// When sleeping, the query cannot be cancelled. For ability to cancel query, we limit sleep time. /// When sleeping, the query cannot be cancelled. For ability to cancel query, we limit sleep time.
UInt64 microseconds = static_cast<UInt64>(seconds * 1e6);
if (max_microseconds && seconds * 1e6 > max_microseconds) if (max_microseconds && seconds * 1e6 > max_microseconds)
throw Exception(ErrorCodes::TOO_SLOW, "The maximum sleep time is {} microseconds. Requested: {}", max_microseconds, seconds); throw Exception(ErrorCodes::TOO_SLOW, "The maximum sleep time is {} microseconds. Requested: {} microseconds",
max_microseconds, microseconds);
if (!dry_run) if (!dry_run)
{ {
UInt64 count = (variant == FunctionSleepVariant::PerBlock ? 1 : size); UInt64 count = (variant == FunctionSleepVariant::PerBlock ? 1 : size);
UInt64 microseconds = static_cast<UInt64>(seconds * count * 1e6); microseconds = static_cast<UInt64>(seconds * count * 1e6);
if (max_microseconds && microseconds > max_microseconds) if (max_microseconds && microseconds > max_microseconds)
throw Exception(ErrorCodes::TOO_SLOW, throw Exception(ErrorCodes::TOO_SLOW,