mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
Cleanup PullingAsyncPipelineExecutor::cancel()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
41a199e175
commit
0566f72d36
@ -175,19 +175,21 @@ 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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user