Fixed regression that prevents app to quit if another process is already running
This commit is contained in:
@@ -223,13 +223,14 @@ namespace Recommendation
|
|||||||
|
|
||||||
engine->load(forceReload, progressCallback ? progress : ProgressCallback {});
|
engine->load(forceReload, progressCallback ? progress : ProgressCallback {});
|
||||||
|
|
||||||
{
|
|
||||||
std::scoped_lock lock {_controlMutex};
|
|
||||||
_pendingEngines.erase(std::find(std::begin(_pendingEngines), std::end(_pendingEngines), engine.get()));
|
|
||||||
}
|
|
||||||
LMS_LOG(RECOMMENDATION, INFO) << "Initializing engine '" << engineTypeToString(engineType) << "': " << (_loadCancelled ? "aborted" : "complete");
|
LMS_LOG(RECOMMENDATION, INFO) << "Initializing engine '" << engineTypeToString(engineType) << "': " << (_loadCancelled ? "aborted" : "complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::scoped_lock lock {_controlMutex};
|
||||||
|
_pendingEngines.erase(std::find(std::begin(_pendingEngines), std::end(_pendingEngines), engine.get()));
|
||||||
|
}
|
||||||
|
|
||||||
if (!_loadCancelled)
|
if (!_loadCancelled)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {_enginesMutex};
|
std::unique_lock lock {_enginesMutex};
|
||||||
@@ -250,7 +251,9 @@ namespace Recommendation
|
|||||||
LMS_LOG(RECOMMENDATION, DEBUG) << "Still " << _pendingEngines.size() << " pending engines!";
|
LMS_LOG(RECOMMENDATION, DEBUG) << "Still " << _pendingEngines.size() << " pending engines!";
|
||||||
|
|
||||||
for (IEngine* engine : _pendingEngines)
|
for (IEngine* engine : _pendingEngines)
|
||||||
|
{
|
||||||
engine->requestCancelLoad();
|
engine->requestCancelLoad();
|
||||||
|
}
|
||||||
|
|
||||||
_pendingEnginesCondvar.wait(controlLock, [this] {return _pendingEngines.empty();});
|
_pendingEnginesCondvar.wait(controlLock, [this] {return _pendingEngines.empty();});
|
||||||
_loadCancelled = false;
|
_loadCancelled = false;
|
||||||
|
|||||||
@@ -270,8 +270,9 @@ ScannerService::ScannerService(Db& db, Recommendation::IRecommendationService& r
|
|||||||
|
|
||||||
ScannerService::~ScannerService()
|
ScannerService::~ScannerService()
|
||||||
{
|
{
|
||||||
LMS_LOG(DBUPDATER, INFO) << "Shutting down Scanner...";
|
LMS_LOG(DBUPDATER, INFO) << "Stopping service...";
|
||||||
stop();
|
stop();
|
||||||
|
LMS_LOG(DBUPDATER, INFO) << "Service stopped!";
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user