Merge pull request #49755 from CurtizJ/fix-unit-test

Fix unit test `ExceptionFromWait`
This commit is contained in:
alesapin 2023-05-12 13:08:48 +02:00 committed by GitHub
commit d147cb105c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,8 +56,17 @@ static bool check2()
{
ThreadPool pool(CurrentMetrics::LocalThread, CurrentMetrics::LocalThreadActive, 2);
pool.scheduleOrThrowOnError([&]{ throw std::runtime_error("Hello, world!"); });
pool.scheduleOrThrowOnError([]{});
try
{
pool.scheduleOrThrowOnError([&]{ throw std::runtime_error("Hello, world!"); });
pool.scheduleOrThrowOnError([]{});
}
catch (const std::runtime_error &)
{
/// Sometimes exception may be thrown from schedule.
/// Just retry test in that case.
return true;
}
try
{