Cleanup PullingAsyncPipelineExecutor::cancel()

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-01-19 19:57:16 +01:00
parent 41a199e175
commit 0566f72d36

View File

@ -175,20 +175,22 @@ bool PullingAsyncPipelineExecutor::pull(Block & block, uint64_t milliseconds)
void PullingAsyncPipelineExecutor::cancel()
{
if (!data)
return;
/// Cancel execution if it wasn't finished.
if (data && !data->is_finished && data->executor)
if (!data->is_finished && data->executor)
data->executor->cancel();
/// The following code is needed to rethrow exception from PipelineExecutor.
/// It could have been thrown from pull(), but we will not likely call it again.
/// Join thread here to wait for possible exception.
if (data && data->thread.joinable())
if (data->thread.joinable())
data->thread.join();
/// Rethrow exception to not swallow it in destructor.
if (data)
data->rethrowExceptionIfHas();
data->rethrowExceptionIfHas();
}
Chunk PullingAsyncPipelineExecutor::getTotals()