[fix](bthread) fix bthread hang (#16594)
This commit is contained in:
@ -159,7 +159,7 @@ private:
|
||||
std::string _group;
|
||||
|
||||
int _timeout_second;
|
||||
bool _cancelled = false;
|
||||
std::atomic<bool> _cancelled {false};
|
||||
|
||||
// This context is shared by all fragments of this host in a query
|
||||
std::shared_ptr<QueryFragmentsCtx> _fragments_ctx;
|
||||
|
||||
@ -694,8 +694,9 @@ Status VNodeChannel::close_wait(RuntimeState* state) {
|
||||
}
|
||||
|
||||
// waiting for finished, it may take a long time, so we couldn't set a timeout
|
||||
while (!_add_batches_finished && !_cancelled) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
while (!_add_batches_finished && !_cancelled && !state->is_cancelled()) {
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
bthread_usleep(1000);
|
||||
}
|
||||
_close_time_ms = UnixMillis() - _close_time_ms;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user