mirror of
https://github.com/clangen/musikcube.git
synced 2024-12-29 00:17:49 +00:00
Forgot to push this fix in last night -- fixes query timeout issues due
to potential int overflow with kWaitIndefinite.
This commit is contained in:
parent
aba46739b6
commit
c536a4bc9d
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user