fix: don't wait for migrate msg if indirection server closes the connection because deployment gets deleted

- if deployment gets deleted than there is no where to migrate the
documents in such cases indirection will close the monitor connection
but we need to set the _migrateMsgReceived flag so that docBroker don't
wait for the message and continue to cleanup the document

Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: Ia2732740927ea16e368f91bea7421576a3cf2beb
pull/7614/head
Rashesh Padia 2024-05-01 20:01:50 +05:30 committed by Rashesh Padia
parent c1f0fcf946
commit 7572af7486
3 changed files with 16 additions and 0 deletions

View File

@ -720,6 +720,11 @@ void Admin::pollingThread()
}
poll(closeMonitorMsgTimeout - elapsedMicroS);
}
// if monitor closes early we set the _migrateMsgReceived for each docbroker
// so that docbroker can cleanup the documents
if (_closeMonitor)
COOLWSD::setAllMigrationMsgReceived();
}
void Admin::modificationAlert(const std::string& docKey, pid_t pid, bool value){

View File

@ -3326,6 +3326,16 @@ void COOLWSD::setMigrationMsgReceived(const std::string& docKey)
}
}
void COOLWSD::setAllMigrationMsgReceived()
{
std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
for (auto& brokerIt : DocBrokers)
{
std::shared_ptr<DocumentBroker> docBroker = brokerIt.second;
docBroker->addCallback([docBroker]() { docBroker->setMigrationMsgReceived(); });
}
}
void COOLWSD::setLogLevelsOfKits(const std::string& level)
{
std::lock_guard<std::mutex> docBrokersLock(DocBrokersMutex);

View File

@ -518,6 +518,7 @@ public:
static void alertAllUsersInternal(const std::string& msg);
static void alertUserInternal(const std::string& dockey, const std::string& msg);
static void setMigrationMsgReceived(const std::string& docKey);
static void setAllMigrationMsgReceived();
#if ENABLE_DEBUG
/// get correct server URL with protocol + port number for this running server