summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-10-20 20:49:29 -0400
committerAndras Timar <andras.timar@collabora.com>2020-10-22 14:40:40 +0200
commit8190cf7869d4674a7a886dd5f6935ac8210f93ca (patch)
treeb8f4da44be877139546a017d09ac7a40f2b8d391
parentwsd: document forced storage saving and remove default args (diff)
downloadonline-8190cf7869d4674a7a886dd5f6935ac8210f93ca.tar.gz
online-8190cf7869d4674a7a886dd5f6935ac8210f93ca.zip
wsd: allow some time between retrying saving
Change-Id: I9d923582057467141a3f4d0b260b982464b60511
-rw-r--r--wsd/DocumentBroker.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 5e0d941e8a..7064667a43 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -434,12 +434,18 @@ void DocumentBroker::pollThread()
// Remove idle documents after 1 hour.
if (isLoaded() && getIdleTimeSecs() >= IdleDocTimeoutSecs)
{
- // Stop if there is nothing to save.
- LOG_INF("Autosaving idle DocumentBroker for docKey [" << getDocKey() << "] to kill.");
- if (!autoSave(isPossiblyModified()))
+ // Don't hammer on saving.
+ if (std::chrono::duration_cast<std::chrono::seconds>(now - _lastSaveRequestTime).count()
+ >= 5)
{
- LOG_INF("Terminating idle DocumentBroker for docKey [" << getDocKey() << "].");
- stop("idle");
+ // Stop if there is nothing to save.
+ LOG_INF("Autosaving idle DocumentBroker for docKey [" << getDocKey()
+ << "] to kill.");
+ if (!autoSave(isPossiblyModified()))
+ {
+ LOG_INF("Terminating idle DocumentBroker for docKey [" << getDocKey() << "].");
+ stop("idle");
+ }
}
}
#endif