mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Added missing wait_for logic in RemoteLibrary
This commit is contained in:
parent
7da49b1981
commit
1258c2803e
@ -46,6 +46,7 @@
|
||||
#include <musikcore/runtime/Message.h>
|
||||
#include <musikcore/debug.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <chrono>
|
||||
|
||||
static const std::string TAG = "RemoteLibrary";
|
||||
|
||||
@ -54,6 +55,7 @@ using namespace musik::core::db;
|
||||
using namespace musik::core::library;
|
||||
using namespace musik::core::net;
|
||||
using namespace musik::core::runtime;
|
||||
using namespace std::chrono;
|
||||
|
||||
#define MESSAGE_QUERY_COMPLETED 5000
|
||||
#define MESSAGE_RECONNECT_SOCKET 5001
|
||||
@ -206,7 +208,10 @@ int RemoteLibrary::EnqueueAndWait(QueryPtr query, int64_t timeoutMs, Callback ca
|
||||
this->IsQueryInFlight(context->query) &&
|
||||
!isQueryDone(context->query))
|
||||
{
|
||||
this->syncQueryCondition.wait(lock);
|
||||
auto result = this->syncQueryCondition.wait_for(lock, timeoutMs * milliseconds(1));
|
||||
if (result == std::cv_status::timeout) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ using namespace musik::core::library::query;
|
||||
using namespace musik::core::sdk;
|
||||
|
||||
static const size_t kDefaultCacheSize = 50;
|
||||
static const int64_t kCacheWindowTimeoutMs = 50LL;
|
||||
static const int64_t kCacheWindowTimeoutMs = 100LL;
|
||||
|
||||
TrackList::TrackList(ILibraryPtr library)
|
||||
: library(library)
|
||||
|
Loading…
Reference in New Issue
Block a user