[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue May 3 03:06:08 UTC 2016
loolwsd/DocumentBroker.cpp | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
New commits:
commit 431bab28248c8fbfc561c8e5aba530e6c97e8e2d
Author: Ashod Nakashian <ashod.nakashian at 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 <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at 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();
}
}
More information about the Libreoffice-commits
mailing list