loolwsd/DocumentBroker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 2efaa6e06b212740abcb89ce26ad9ab8d585d204 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Wed Apr 27 20:52:32 2016 -0400 loolwsd: save documents when timestamp is within 10 seconds Due to filesystem timestamp precision and other factors we assume a timestamp match within 10 seconds to mean the document has been recently saved and store it. A document has to have an older than 10 seconds modified timestamp compared to our last timestamp to be deemed unchanged in the interim and skipped from storing again. Change-Id: I39b4bf64b221ba30dc7b818a330e779a2d0ecbd4 Reviewed-on: https://gerrit.libreoffice.org/24472 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 69728cb..ac1ed91 100644 --- a/loolwsd/DocumentBroker.cpp +++ b/loolwsd/DocumentBroker.cpp @@ -152,8 +152,11 @@ bool DocumentBroker::save() std::unique_lock<std::mutex> lock(_saveMutex); const auto uri = _uriPublic.toString(); + + // If the file hasn't been modified within the past 10 seconds, skip saving. const auto newFileModifiedTime = Poco::File(_storage->getLocalRootPath()).getLastModified(); - if (newFileModifiedTime == _lastFileModifiedTime) + const auto elapsed = newFileModifiedTime - _lastFileModifiedTime; + if (std::abs(elapsed) > 10 * 1000 * 1000) { // Nothing to do. Log::debug("Skipping unnecessary saving to URI [" + uri + "]."); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits