loolwsd/DocumentBroker.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
New commits: commit 431bab28248c8fbfc561c8e5aba530e6c97e8e2d Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Mon May 2 22:58:53 2016 -0400 loolwsd: fix autosave regression Autosave should only save when the user has been idle for a certain time, or the periodic autosave time elapses. The document is considered for autosave only when it's modified. Change-Id: Ia239173ff6636e52c1a2b7e1f6bf9bd6860175ed Reviewed-on: https://gerrit.libreoffice.org/24602 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp index 0d88d75..5dbdf46 100644 --- a/loolwsd/DocumentBroker.cpp +++ b/loolwsd/DocumentBroker.cpp @@ -204,11 +204,11 @@ bool DocumentBroker::autoSave(const bool force, const size_t waitTimeoutMs) } bool sent = false; - if (force || _isModified) + if (force) { sent = sendUnoSave(); } - else + else if (_isModified) { // Find the most recent activity. double inactivityTimeMs = std::numeric_limits<double>::max(); @@ -221,16 +221,11 @@ bool DocumentBroker::autoSave(const bool force, const size_t waitTimeoutMs) const auto timeSinceLastSaveMs = getTimeSinceLastSaveMs(); Log::trace("Time since last save is " + std::to_string((int)timeSinceLastSaveMs) + " ms."); - // There has been some editing since we saved last? - if (inactivityTimeMs < timeSinceLastSaveMs) + // Either we've been idle long enough, or it's auto-save time. + if (inactivityTimeMs >= IdleSaveDurationMs || + timeSinceLastSaveMs >= AutoSaveDurationMs) { - // Either we've been idle long enough, or it's auto-save time. - // Or we are asked to save anyway. - if (inactivityTimeMs >= IdleSaveDurationMs || - timeSinceLastSaveMs >= AutoSaveDurationMs) - { - sent = sendUnoSave(); - } + sent = sendUnoSave(); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits