diff --git a/code/nel/tools/pipeline/pipeline_service/database_status.cpp b/code/nel/tools/pipeline/pipeline_service/database_status.cpp index 806883c51..8521ceeab 100644 --- a/code/nel/tools/pipeline/pipeline_service/database_status.cpp +++ b/code/nel/tools/pipeline/pipeline_service/database_status.cpp @@ -381,10 +381,10 @@ void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback) { std::vector paths; paths.push_back(g_DatabaseDirectory); - updateDatabaseStatus(callback, paths, true); + updateDatabaseStatus(callback, paths, false, true); } -void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback, const std::vector &paths, bool recurse) +void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback, const std::vector &paths, bool wait, bool recurse) { CDatabaseStatusUpdater *updater = new CDatabaseStatusUpdater(); updater->Callback = callback; @@ -411,6 +411,16 @@ void CDatabaseStatus::updateDatabaseStatus(const CCallback &callback, cons updater->Mutex.leave(); if (done) updater->doneRemove(); + + if (wait) + { + // UGLY_CODE -> + while (!updater->CallbackCalled) + { + nlSleep(10); + } + // <- UGLY_CODE + } } // ****************************************************************** diff --git a/code/nel/tools/pipeline/pipeline_service/database_status.h b/code/nel/tools/pipeline/pipeline_service/database_status.h index bc96eb6de..0bbb99f6f 100644 --- a/code/nel/tools/pipeline/pipeline_service/database_status.h +++ b/code/nel/tools/pipeline/pipeline_service/database_status.h @@ -106,10 +106,10 @@ public: bool getFileStatus(CFileStatus &fileStatus, const std::string &filePath) const; /// Updates the file status asynchronously. The new file status is broadcast to clients and slaves afterwards. Warning: If g_IsExiting during callback then update likely did not happen. NLMISC::IRunnable *updateFileStatus(const TFileStatusCallback &callback, const std::string &filePath); - /// Runs an update of the complete {{DatabaseDirectory}} status. Warning: If g_IsExiting during callback then update is incomplete. Callback is always called when done (or failed). + /// Runs an update of the complete {{DatabaseDirectory}} status asynchronously. Warning: If g_IsExiting during callback then update is incomplete. Callback is always called when done (or failed). void updateDatabaseStatus(const CCallback &callback); - /// Runs an update of the file status of given paths. Warning: If g_IsExiting during callback then update is incomplete. Callback is always called when done (or failed). Do NOT use recurse, please. Recurse directories beforehand. Paths may contain db and pl macros. - void updateDatabaseStatus(const CCallback &callback, const std::vector &paths, bool recurse = false); + /// Runs an update of the file status of given paths asynchronously. Warning: If g_IsExiting during callback then update is incomplete. Callback is always called when done (or failed). Do NOT use the wait parameter. Do NOT use recurse, please. Recurse directories beforehand. Paths may contain db and pl macros. + void updateDatabaseStatus(const CCallback &callback, const std::vector &paths, bool wait = false, bool recurse = false); void getFileErrors(CFileErrors &fileErrors, const std::string &filePath, uint32 newerThan = 0) const; void addFileError(const std::string &filePath, const CFileError &fileError);