[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Apr 3 05:16:01 UTC 2017


 wsd/DocumentBroker.cpp |    3 +++
 wsd/LOOLWSD.cpp        |   16 ++++++++--------
 wsd/LOOLWSD.hpp        |    4 +++-
 3 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit c81db872352443cb0c3ac0f7c0d68f27fcd34963
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 2 19:56:42 2017 -0400

    wsd: do child housekeeping on finishing DocBroker thread
    
    Change-Id: I109737b79759986cb2a1cbfc6d711ee2f19ff59d
    Reviewed-on: https://gerrit.libreoffice.org/36034
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index ae7f6e71..a89e3862 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -260,6 +260,9 @@ void DocumentBroker::pollThread()
         _poll->poll(std::min(flushTimeoutMs - elapsedMs, POLL_TIMEOUT_MS / 5));
     }
 
+    // Cleanup.
+    LOOLWSD::doHousekeeping();
+
     LOG_INF("Finished docBroker polling thread for docKey [" << _docKey << "].");
 }
 
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 2cc7bf51..6b2d633b 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1101,6 +1101,11 @@ bool LOOLWSD::checkAndRestoreForKit()
 
 void PrisonerPoll::wakeupHook()
 {
+    LOOLWSD::doHousekeeping();
+}
+
+void LOOLWSD::doHousekeeping()
+{
     if (!LOOLWSD::checkAndRestoreForKit())
     {
         // No children have died.
@@ -1136,11 +1141,6 @@ void PrisonerPoll::wakeupHook()
         cleanupDocBrokers();
 }
 
-void LOOLWSD::triggerChildAndDocHousekeeping()
-{
-    PrisonerPoll.wakeup();
-}
-
 bool LOOLWSD::createForKit()
 {
 #ifdef KIT_IN_PROCESS
@@ -2428,9 +2428,9 @@ int LOOLWSD::innerMain()
         UnitWSD::get().invokeTest();
 
         // This timeout affects the recovery time of prespawned children.
-        int msWait = UnitWSD::isUnitTesting() ?
-            UnitWSD::get().getTimeoutMilliSeconds() / 4 :
-            SocketPoll::DefaultPollTimeoutMs * 4;
+        const int msWait = UnitWSD::isUnitTesting() ?
+                           UnitWSD::get().getTimeoutMilliSeconds() / 4 :
+                           SocketPoll::DefaultPollTimeoutMs * 4;
         mainWait.poll(msWait);
 
         // Wake the prisoner poll to spawn some children, if necessary.
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index b86b23ac..072a4a88 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -100,7 +100,9 @@ public:
     /// Return true when successfull.
     static bool createForKit();
 
-    static void triggerChildAndDocHousekeeping();
+    /// Checks forkit (and respawns), rebalances
+    /// child kit processes and cleans up DocBrokers.
+    static void doHousekeeping();
 
 protected:
     void initialize(Poco::Util::Application& self) override;


More information about the Libreoffice-commits mailing list