loolwsd.xml.in | 5 +++-- wsd/DocumentBroker.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
New commits: commit e0015bda178325f989e5de72dd92bff0d6312a1c Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Jun 5 17:24:05 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Jun 13 10:08:08 2019 +0200 wsd: allow disabling idlesave and autosave from configuration The code already assumed a signed integer, but the configuration advertised unsigned, standardize on signed. This way it doesn't matter if the "disable" value is zero or a negative number. (cherry picked from commit 3c927a9f325d74516e6671930de4eb01f2a9b056) Change-Id: I56632c8a36be01afefdc5f2a35e70bde945d69d3 Reviewed-on: https://gerrit.libreoffice.org/73562 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit 0cb985db98337b35ea1875f49223e8ae4d3a5e20) Reviewed-on: https://gerrit.libreoffice.org/73569 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/loolwsd.xml.in b/loolwsd.xml.in index 296418a7c..be2b53da8 100644 --- a/loolwsd.xml.in +++ b/loolwsd.xml.in @@ -21,8 +21,9 @@ <redlining_as_comments desc="If true show red-lines as comments" type="bool" default="true">true</redlining_as_comments> <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> + <!-- They are disabled when the value is zero or negative. --> + <idlesave_duration_secs desc="The number of idle seconds after which document, if modified, should be saved. Defaults to 30 seconds." type="int" 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="int" 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 674fb2f4a..253774249 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -1022,9 +1022,18 @@ bool DocumentBroker::autoSave(const bool force) static const int idleSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.idlesave_duration_secs", 30) * 1000; static const int autoSaveDurationMs = LOOLWSD::getConfigValue<int>("per_document.autosave_duration_secs", 300) * 1000; + bool save = false; + // Zero or negative config value disables save. // Either we've been idle long enough, or it's auto-save time. - if (inactivityTimeMs >= idleSaveDurationMs || - timeSinceLastSaveMs >= autoSaveDurationMs) + if (idleSaveDurationMs > 0 && inactivityTimeMs >= idleSaveDurationMs) + { + save = true; + } + if (autoSaveDurationMs > 0 && timeSinceLastSaveMs >= autoSaveDurationMs) + { + save = true; + } + if (save) { LOG_TRC("Sending timed save command for [" << _docKey << "]."); sent = sendUnoSave(savingSessionId, /*dontTerminateEdit=*/true, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits