[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loolwsd.xml.in wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue May 16 14:32:49 UTC 2017
loolwsd.xml.in | 15 ++++++++-------
wsd/DocumentBroker.cpp | 4 +++-
wsd/LOOLWSD.cpp | 1 +
wsd/LOOLWSD.hpp | 9 +++++++++
4 files changed, 21 insertions(+), 8 deletions(-)
New commits:
commit fb2fdeb298c5bb4e2c31f9cac8a187fa7c2f2265
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun May 7 13:28:57 2017 -0400
wsd: configurable idle document timeout
When a document is idle (no activity from
any views) for this timeout duration, the
document is saved and unloaded to minimize
resource consumption.
Change-Id: If6f09136ae40c7e84180fc8c8adbf6db8396d292
Reviewed-on: https://gerrit.libreoffice.org/37374
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
(cherry picked from commit 7d823787bbdb8790aeca379c160873f3924b9942)
Reviewed-on: https://gerrit.libreoffice.org/37414
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 5640d08f..449d9797 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -14,6 +14,7 @@
<num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="1">1</num_prespawn_children>
<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>
</per_document>
<loleaflet_html desc="Allows UI customization by replacing the single endpoint of loleaflet.html" type="string" default="loleaflet.html">loleaflet.html</loleaflet_html>
@@ -51,13 +52,13 @@
<cert_file_path desc="Path to the cert file" relative="false">/etc/loolwsd/cert.pem</cert_file_path>
<key_file_path desc="Path to the key file" relative="false">/etc/loolwsd/key.pem</key_file_path>
<ca_file_path desc="Path to the ca file" relative="false">/etc/loolwsd/ca-chain.cert.pem</ca_file_path>
- <hpkp desc="Enable HTTP Public key pinning" enable="false" report_only="false">
- <max_age desc="HPKP's max-age directive - time in seconds browser should remember the pins" enable="true">1000</max_age>
- <report_uri desc="HPKP's report-uri directive - pin validation failure are reported at this URL" enable="false"></report_uri>
- <pins desc="Base64 encoded SPKI fingerprints of keys to be pinned">
- <pin></pin>
- </pins>
- </hpkp>
+ <hpkp desc="Enable HTTP Public key pinning" enable="false" report_only="false">
+ <max_age desc="HPKP's max-age directive - time in seconds browser should remember the pins" enable="true">1000</max_age>
+ <report_uri desc="HPKP's report-uri directive - pin validation failure are reported at this URL" enable="false"></report_uri>
+ <pins desc="Base64 encoded SPKI fingerprints of keys to be pinned">
+ <pin></pin>
+ </pins>
+ </hpkp>
</ssl>
<storage desc="Backend storage">
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index bc5db5ed..0dac41b5 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -221,6 +221,8 @@ void DocumentBroker::pollThread()
auto last30SecCheckTime = std::chrono::steady_clock::now();
static const bool AutoSaveEnabled = !std::getenv("LOOL_NO_AUTOSAVE");
+ static const size_t IdleDocTimeoutSecs = LOOLWSD::getConfigValue<int>(
+ "per_document.idle_timeout_secs", 3600);
// Main polling loop goodness.
while (!_stop && _poll->continuePolling() && !TerminationFlag)
@@ -276,7 +278,7 @@ void DocumentBroker::pollThread()
}
// Remove idle documents after 1 hour.
- const bool idle = (getIdleTimeSecs() >= 3600);
+ const bool idle = (getIdleTimeSecs() >= IdleDocTimeoutSecs);
// If all sessions have been removed, no reason to linger.
if ((isLoaded() || _markToDestroy) && (_sessions.empty() || idle))
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 57d3f0d4..47323ed7 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -618,6 +618,7 @@ void LOOLWSD::initialize(Application& self)
{ "file_server_root_path", "loleaflet/.." },
{ "num_prespawn_children", "1" },
{ "per_document.max_concurrency", "4" },
+ { "per_document.idle_timeout_secs", "3600" },
{ "loleaflet_html", "loleaflet.html" },
{ "logging.color", "true" },
{ "logging.level", "trace" },
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 72c3a9a1..46538dc0 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -81,6 +81,15 @@ public:
return LOOLWSD::SSLTermination.get();
}
+ /// Returns the value of the specified application configuration,
+ /// of the default, if one doesn't exist.
+ template<typename T>
+ static
+ T getConfigValue(const std::string& name, const T def)
+ {
+ return getConfigValue(Application::instance().config(), name, def);
+ }
+
/// Trace a new session and take a snapshot of the file.
static void dumpNewSessionTrace(const std::string& id, const std::string& sessionId, const std::string& uri, const std::string& path);
More information about the Libreoffice-commits
mailing list