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 7d823787bbdb8790aeca379c160873f3924b9942 Author: Ashod Nakashian <ashod.nakash...@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 <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.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 ad958964..f5af9895 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -222,6 +222,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) @@ -273,7 +275,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 9c497e13..7f6703f0 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -622,6 +622,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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits