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

Pranav Kant pranavk at collabora.co.uk
Thu Aug 24 11:24:48 UTC 2017


 loolwsd.xml.in         |    3 +++
 wsd/DocumentBroker.cpp |    6 ++++--
 wsd/DocumentBroker.hpp |    3 ---
 wsd/LOOLWSD.cpp        |    2 ++
 4 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit ad211ef51b1f87d8ab587d991bda253b54bb6be1
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Aug 24 16:40:39 2017 +0530

    wsd: Configurable autosave and idlesave durations
    
    But these save conditions are checked every 30 seconds only, so setting
    them to less than 30 seconds wouldn't mean that save will be triggered
    anytime sooner.
    
    Change-Id: Id473a79af6a3170c72e372040460f2b7c15f150e

diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index a8b67737..5097d9ac 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -16,6 +16,9 @@
     <per_document desc="Document-specific settings, including LO Core settings.">
         <max_concurrency desc="The maximum number of threads to use while processing a document." type="uint" default="4">4</max_concurrency>
         <idle_timeout_secs desc="The maximum number of seconds before unloading an idle document. Defaults to 1 hour." type="uint" default="3600">3600</idle_timeout_secs>
+        <!-- Idle save and auto save are checked every 30 seconds -->
+        <idlesave_duration_secs desc="The number of idle seconds after which document, if modified, should be saved. Defaults to 30 seconds." type="uint" default="30">30</idlesave_duration_secs>
+        <autosave_duration_secs desc="The number of seconds after which document, if modified, should be saved. Defaults to 5 minutes." type="uint" default="300">300</autosave_duration_secs>
         <limit_virt_mem_kb desc="The maximum virtual memory allowed to each document process. 0 for unlimited, 1700 min." type="uint">0</limit_virt_mem_kb>
         <limit_data_mem_kb desc="The maximum memory data segment allowed to each document process. 0 for unlimited." type="uint">0</limit_data_mem_kb>
         <limit_stack_mem_kb desc="The maximum stack size allowed to each document process. 0 for unlimited." type="uint">8000</limit_stack_mem_kb>
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 77035837..6744b838 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -799,9 +799,11 @@ bool DocumentBroker::autoSave(const bool force)
         LOG_TRC("Time since last save of docKey [" << _docKey << "] is " << timeSinceLastSaveMs <<
                 "ms and most recent activity was " << inactivityTimeMs << "ms ago.");
 
+        static const auto idleSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.idlesave_duration_secs", 30) * 1000;
+        static const auto autoSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.autosave_duration_secs", 300) * 1000;
         // Either we've been idle long enough, or it's auto-save time.
-        if (inactivityTimeMs >= IdleSaveDurationMs ||
-            timeSinceLastSaveMs >= AutoSaveDurationMs)
+        if (inactivityTimeMs >= idleSaveDurationMs ||
+            timeSinceLastSaveMs >= autoSaveDurationMs)
         {
             LOG_TRC("Sending timed save command for [" << _docKey << "].");
             sent = sendUnoSave(savingSessionId);
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index b08fd2e9..ecaaa30a 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -435,9 +435,6 @@ private:
 
     /// Unique DocBroker ID for tracing and debugging.
     static std::atomic<unsigned> DocBrokerId;
-
-    static constexpr auto IdleSaveDurationMs = 30 * 1000;
-    static constexpr auto AutoSaveDurationMs = 300 * 1000;
 };
 
 #endif
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 37e56dd2..dc389dcf 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -633,6 +633,8 @@ void LOOLWSD::initialize(Application& self)
             { "num_prespawn_children", "1" },
             { "per_document.max_concurrency", "4" },
             { "per_document.idle_timeout_secs", "3600" },
+            { "per_document.idlesave_duration_secs", "30" },
+            { "per_document.autosave_duration_secs", "300" },
             { "per_document.limit_virt_mem_mb", "0" },
             { "per_document.limit_stack_mem_kb", "8000" },
             { "per_document.limit_file_size_mb", "50" },


More information about the Libreoffice-commits mailing list