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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jan 11 07:13:34 UTC 2018


 common/MessageQueue.hpp |    1 -
 wsd/DocumentBroker.cpp  |   10 ++++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 5f175c5120fa719563dca6eea625f351bdeada34
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Jan 11 01:29:08 2018 -0500

    wsd: save documents before recycling
    
    Change-Id: I24afc5c1bceca272f23a129609f73fc5a8d3caf2
    Reviewed-on: https://gerrit.libreoffice.org/47739
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/common/MessageQueue.hpp b/common/MessageQueue.hpp
index 2ab30fb1..c3ae0e21 100644
--- a/common/MessageQueue.hpp
+++ b/common/MessageQueue.hpp
@@ -95,7 +95,6 @@ public:
 protected:
     virtual void put_impl(const Payload& value)
     {
-        const auto msg = std::string(value.data(), value.size());
         _queue.push_back(value);
     }
 
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 6a164533..d2d627a3 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -269,6 +269,7 @@ void DocumentBroker::pollThread()
 
         if (ShutdownRequestFlag)
         {
+            autoSave(true);
             _closeReason = "recycling";
             _stop = true;
         }
@@ -295,7 +296,7 @@ void DocumentBroker::pollThread()
 
     LOG_INF("Finished polling doc [" << _docKey << "]. stop: " << _stop << ", continuePolling: " <<
             _poll->continuePolling() << ", ShutdownRequestFlag: " << ShutdownRequestFlag <<
-            ", TerminationFlag: " << TerminationFlag << ".");
+            ", TerminationFlag: " << TerminationFlag << ", closeReason: " << _closeReason << ". Flushing socket.");
 
     // Flush socket data first.
     const int flushTimeoutMs = POLL_TIMEOUT_MS * 2; // ~1000ms
@@ -310,6 +311,10 @@ void DocumentBroker::pollThread()
         _poll->poll(std::min(flushTimeoutMs - elapsedMs, POLL_TIMEOUT_MS / 5));
     }
 
+    LOG_INF("Finished flushing socket for doc [" << _docKey << "]. stop: " << _stop << ", continuePolling: " <<
+            _poll->continuePolling() << ", ShutdownRequestFlag: " << ShutdownRequestFlag <<
+            ", TerminationFlag: " << TerminationFlag << ". Terminating child with reason: [" << _closeReason << "].");
+
     // Terminate properly while we can.
     terminateChild(_closeReason);
 
@@ -859,7 +864,8 @@ bool DocumentBroker::autoSave(const bool force)
     if (force)
     {
         LOG_TRC("Sending forced save command for [" << _docKey << "].");
-        sent = sendUnoSave(savingSessionId);
+        // Don't terminate editing as this can be invoked by the admin OOM, but otherwise force saving anyway.
+        sent = sendUnoSave(savingSessionId, /*dontTerminateEdit=*/ true, /*dontSaveIfUnmodified=*/ false, /*isAutosave=*/ false);
     }
     else if (_isModified)
     {


More information about the Libreoffice-commits mailing list