[Libreoffice-commits] online.git: 2 commits - common/FileUtil.cpp common/FileUtil.hpp loleaflet/Makefile.am wsd/LOOLWSD.cpp

Pranav Kant pranavk at collabora.co.uk
Wed Jan 4 08:51:35 UTC 2017


 common/FileUtil.cpp   |    5 +++--
 common/FileUtil.hpp   |    4 ++--
 loleaflet/Makefile.am |    2 ++
 wsd/LOOLWSD.cpp       |    8 ++++++--
 4 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 62a666c06a9b1398bac67a72b14e1c221e71dfd4
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jan 4 11:59:45 2017 +0530

    wsd: better handling of low storage situation
    
    There is no way to let the user of document currently being
    opened, in case of failure, know that disk is low on space.
    We check the disk space when forking children after which we try
    to alert all users but this would end up doing nothing for
    current document because document broker is not registered at
    this time (we iterate through doc brokers when alerting). Another
    conditional disk check is performed just before opening the
    document but this is performed only if last disk check was
    performed greater than 60 seconds which would never be the case
    because document open is always preceded by a child fork (when
    rebalancing children).
    
    Lets not cache the disk check when forking the children to
    prevent above mentioned situation while still minimizing the
    number of disk checks performed.
    
    Change-Id: Id3add998f94e23f9f8c144f09e5efe9f0b63821c

diff --git a/common/FileUtil.cpp b/common/FileUtil.cpp
index afe2634..0127c1a 100644
--- a/common/FileUtil.cpp
+++ b/common/FileUtil.cpp
@@ -158,7 +158,7 @@ namespace FileUtil
         }
     }
 
-    std::string checkDiskSpaceOnRegisteredFileSystems()
+    std::string checkDiskSpaceOnRegisteredFileSystems(const bool cacheLastCheck)
     {
         std::lock_guard<std::mutex> lock(fsmutex);
 
@@ -169,7 +169,8 @@ namespace FileUtil
         if (std::chrono::duration_cast<std::chrono::seconds>(now - lastCheck).count() < 60)
             return std::string();
 
-        lastCheck = now;
+        if (cacheLastCheck)
+            lastCheck = now;
 
         for (auto& i: filesystems)
         {
diff --git a/common/FileUtil.hpp b/common/FileUtil.hpp
index e0e9487..e018691 100644
--- a/common/FileUtil.hpp
+++ b/common/FileUtil.hpp
@@ -50,8 +50,8 @@ namespace FileUtil
 
     // Perform the check. If the free space on any of the registered file systems is below 5%, call
     // 'alertAllUsers("internal", "diskfull")'. The check will be made no more often than once a
-    // minute.
-    std::string checkDiskSpaceOnRegisteredFileSystems();
+    // minute if cacheLastCheck is set to true.
+    std::string checkDiskSpaceOnRegisteredFileSystems(const bool cacheLastCheck = true);
 
     // Check disk space on a specific file system, the one where 'path' is located. This does not
     // add that file system to the list used by 'registerFileSystemForDiskSpaceChecks'. If the free
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 9895a76..1eed34d 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -314,7 +314,7 @@ static bool forkChildren(const int number)
 
     if (number > 0)
     {
-        const std::string fs = FileUtil::checkDiskSpaceOnRegisteredFileSystems();
+        const std::string fs = FileUtil::checkDiskSpaceOnRegisteredFileSystems(false);
         if (!fs.empty())
         {
             LOG_WRN("File system of " << fs << " dangerously low on disk space");
@@ -1027,7 +1027,11 @@ private:
             if (!fs.empty())
             {
                 LOG_WRN("File system of [" << fs << "] is dangerously low on disk space.");
-                Util::alertAllUsers("error: cmd=internal kind=diskfull");
+                const std::string diskfullMsg = "error: cmd=internal kind=diskfull";
+                // Alert the session currently being opened
+                ws->sendFrame(diskfullMsg.data(), diskfullMsg.size());
+                // Alert all other existing sessions also
+                Util::alertAllUsers(diskfullMsg);
             }
 
             LOOLWSD::dumpEventTrace(docBroker->getJailId(), id, "NewSession: " + uri);
commit fe1fe65e44509d84ef28a6455ebb7b8dd4551eee
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jan 4 09:54:55 2017 +0530

    Include loleaflet files to source archive
    
    Change-Id: Ia7583786fd5a709e56f3319fac25e554465ab3df

diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index fa454c3..ade8fee 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -10,6 +10,8 @@ DRAW_VERSION=0.2.4
 
 MINIFY=false
 
+EXTRA_DIST = $(shell git ls-files)
+
 .PHONY: build
 build: node_modules
 	rm -rf dist/plugins/draw-$(DRAW_VERSION) && mkdir -p dist/plugins/draw-$(DRAW_VERSION)


More information about the Libreoffice-commits mailing list