Revert some unnecessary and buggy restructuring of

RemoteLibrary::EnqueueAndWait(). While required for LocalLibrary, this
causes issues with RemoteLibrary.
This commit is contained in:
casey langen 2020-10-31 13:40:12 -07:00
parent bd7c60fd57
commit d612a59999

View File

@ -199,29 +199,24 @@ int RemoteLibrary::EnqueueAndWait(QueryPtr query, size_t timeoutMs, Callback cal
context->query = serializableQuery;
context->callback = callback;
if (timeoutMs == kWaitIndefinite) {
this->RunQuery(context);
}
else {
queryQueue.push_back(context);
queueCondition.notify_all();
queryQueue.push_back(context);
queueCondition.notify_all();
if (timeoutMs > 0) {
while (
!this->exit &&
this->IsQueryInFlight(context->query) &&
!isQueryDone(context->query))
{
if (timeoutMs == kWaitIndefinite) {
this->syncQueryCondition.wait(lock);
if (timeoutMs > 0) {
while (
!this->exit &&
this->IsQueryInFlight(context->query) &&
!isQueryDone(context->query))
{
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;
}
else {
auto result = this->syncQueryCondition.wait_for(lock, timeoutMs * milliseconds(1));
if (result == std::cv_status::timeout) {
break;
}
}
}
}
}