Skip to content

Commit

Permalink
wsd: allow some time between retrying saving
Browse files Browse the repository at this point in the history
Change-Id: I9d923582057467141a3f4d0b260b982464b60511
  • Loading branch information
Ashod authored and timar committed Oct 22, 2020
1 parent c719984 commit 8190cf7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions wsd/DocumentBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8190cf7

Please sign in to comment.