Forgot to push this fix in last night -- fixes query timeout issues due

to potential int overflow with kWaitIndefinite.
This commit is contained in:
casey langen 2020-10-28 11:21:49 -07:00
parent aba46739b6
commit c536a4bc9d
2 changed files with 16 additions and 5 deletions

View File

@ -213,9 +213,14 @@ int LocalLibrary::EnqueueAndWait(QueryPtr query, size_t timeoutMs, Callback call
context->query->GetStatus() == db::IQuery::Running)
)
{
auto result = this->queueCondition.wait_for(lock, timeoutMs * milliseconds(1));
if (result == std::cv_status::timeout) {
break;
if (timeoutMs == kWaitIndefinite) {
this->queueCondition.wait(lock);
}
else {
auto result = this->queueCondition.wait_for(lock, timeoutMs * milliseconds(1));
if (result == std::cv_status::timeout) {
break;
}
}
}
}

View File

@ -208,10 +208,16 @@ int RemoteLibrary::EnqueueAndWait(QueryPtr query, size_t timeoutMs, Callback cal
this->IsQueryInFlight(context->query) &&
!isQueryDone(context->query))
{
auto result = this->syncQueryCondition.wait_for(lock, timeoutMs * milliseconds(1));
if (result == std::cv_status::timeout) {
if (timeoutMs == kWaitIndefinite) {
this->syncQueryCondition.wait(lock);
break;
}
else {
auto result = this->syncQueryCondition.wait_for(lock, timeoutMs * milliseconds(1));
if (result == std::cv_status::timeout) {
break;
}
}
}
}