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 99bd357ad171ee54eb09a0717ae2ebeedf762a77
Author: Pranav Kant <pran...@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
    (cherry picked from commit f5bf792bb006198ff0fa95951ceeb25fb78e9bee)
    Reviewed-on: https://gerrit.libreoffice.org/41515
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

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 6c76f9dc..7ee65646 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -753,9 +753,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 79d81bd0..1030237b 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -429,9 +429,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 0ae2ee4e..62a4bf46 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -626,6 +626,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" },
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to