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@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>libreoffice-5-4
parent
f9ee1c6150
commit
7d823787bb
|
@ -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">
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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" },
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue