Remove unnecessary flag

This commit is contained in:
Igor Nikonov 2023-10-24 14:52:47 +00:00
parent 1375733643
commit 2c055480d6
2 changed files with 2 additions and 5 deletions

View File

@ -42,7 +42,7 @@ void RemoteSource::setStorageLimits(const std::shared_ptr<const StorageLimitsLis
ISource::Status RemoteSource::prepare() ISource::Status RemoteSource::prepare()
{ {
/// Check if query was cancelled before returning Async status. Otherwise it may lead to infinite loop. /// Check if query was cancelled before returning Async status. Otherwise it may lead to infinite loop.
if (was_query_canceled) if (isCancelled())
{ {
getPort().finish(); getPort().finish();
return Status::Finished; return Status::Finished;
@ -67,7 +67,7 @@ ISource::Status RemoteSource::prepare()
std::optional<Chunk> RemoteSource::tryGenerate() std::optional<Chunk> RemoteSource::tryGenerate()
{ {
/// onCancel() will do the cancel if the query was sent. /// onCancel() will do the cancel if the query was sent.
if (was_query_canceled) if (isCancelled())
return {}; return {};
if (!was_query_sent) if (!was_query_sent)
@ -169,7 +169,6 @@ std::optional<Chunk> RemoteSource::tryGenerate()
void RemoteSource::onCancel() void RemoteSource::onCancel()
{ {
was_query_canceled = true;
query_executor->cancel(); query_executor->cancel();
} }
@ -177,7 +176,6 @@ void RemoteSource::onUpdatePorts()
{ {
if (getPort().isFinished()) if (getPort().isFinished())
{ {
was_query_canceled = true;
query_executor->finish(); query_executor->finish();
} }
} }

View File

@ -39,7 +39,6 @@ protected:
void onCancel() override; void onCancel() override;
private: private:
std::atomic<bool> was_query_canceled = false;
bool was_query_sent = false; bool was_query_sent = false;
bool add_aggregation_info = false; bool add_aggregation_info = false;
RemoteQueryExecutorPtr query_executor; RemoteQueryExecutorPtr query_executor;