diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2022-08-04 21:49:33 -0400 |
---|---|---|
committer | Gökay ŞATIR <gokaysatir@gmail.com> | 2022-09-09 09:47:27 +0300 |
commit | 61866f4432e7b3ed78076300b30a84ced72d7b0d (patch) | |
tree | f4c7fb82f04884c00f4b7230a6cf99ab34ab0e25 | |
parent | wsd: track modifying user commands (diff) | |
download | online-61866f4432e7b3ed78076300b30a84ced72d7b0d.tar.gz online-61866f4432e7b3ed78076300b30a84ced72d7b0d.zip |
wsd: state-dumping and comments
Change-Id: I2522d1578faf28c40682f63dd487efde9c5a738d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
-rw-r--r-- | wsd/DocumentBroker.cpp | 9 | ||||
-rw-r--r-- | wsd/DocumentBroker.hpp | 19 |
2 files changed, 17 insertions, 11 deletions
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 7ac387b0fa..b782e8e630 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -1964,8 +1964,8 @@ bool DocumentBroker::autoSave(const bool force, const bool dontSaveIfUnmodified) bool save = false; // Zero or negative config value disables save. // Either we've been idle long enough, or it's auto-save time. - if (MaxIdleSaveDurationMs > std::chrono::milliseconds::zero() - && inactivityTimeMs >= MaxIdleSaveDurationMs) + if (MaxIdleSaveDurationMs > std::chrono::milliseconds::zero() && + inactivityTimeMs >= MaxIdleSaveDurationMs) { save = true; } @@ -2112,14 +2112,15 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat // Invalidate the timestamp to force persisting. _saveManager.setLastModifiedTime(std::chrono::system_clock::time_point()); - // We do not want save to terminate editing mode if we are in edit mode now - std::ostringstream oss; // arguments init oss << '{'; if (dontTerminateEdit) { + // We do not want save to terminate editing mode if we are in edit mode now. + //TODO: Perhaps we want to terminate if forced by the user, + // otherwise autosave doesn't terminate? oss << "\"DontTerminateEdit\":" "{" "\"type\":\"boolean\"," diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 6f9a4100a0..9a119447a0 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -425,6 +425,8 @@ public: std::unique_lock<std::mutex> getLock() { return std::unique_lock<std::mutex>(_mutex); } + /// Update the last activity time to now. + /// Best to be inlined as it's called frequently. void updateLastActivityTime(); /// Sets the last activity timestamp that is most likely to modify the document. @@ -916,7 +918,7 @@ private: { const auto now = std::chrono::steady_clock::now(); os << indent << "isSaving now: " << std::boolalpha << isSaving(); - os << indent << "auto-save enabled: " << std::boolalpha << _isAutosaveEnabled; + os << indent << "auto-save enabled: " << std::boolalpha << isAutosaveEnabled(); os << indent << "auto-save interval: " << _autosaveInterval; os << indent << "last auto-save check time: " << Util::getTimeForLog(now, _lastAutosaveCheckTime); @@ -1062,14 +1064,16 @@ private: void dumpState(std::ostream& os, const std::string& indent = "\n ") { const auto now = std::chrono::steady_clock::now(); - os << indent << "last upload time: " << Util::getTimeForLog(now, getLastUploadTime()); - os << indent << "last upload was successful: " << lastUploadSuccessful(); - os << indent << "upload failure count: " << uploadFailureCount(); - os << indent << "last modified time (on server): " << _lastModifiedTime; - os << indent << "since last upload request: " << timeSinceLastUploadRequest(); - os << indent << "since last upload response: " << timeSinceLastUploadResponse(); + os << indent << "last upload request time: " + << Util::getTimeForLog(now, _request.lastRequestTime()); + os << indent << "last upload response time: " + << Util::getTimeForLog(now, _request.lastResponseTime()); + os << indent << "last modified time (on server): " << getLastModifiedTime(); os << indent << "file last modified: " << Util::getTimeForLog(now, _lastUploadedFileModifiedTime); + os << indent << "last upload was successful: " << std::boolalpha + << lastUploadSuccessful(); + os << indent << "upload failure count: " << uploadFailureCount(); } private: @@ -1303,6 +1307,7 @@ private: int _debugRenderedTileCount; + /// Time of the last interactive event received. std::chrono::steady_clock::time_point _lastActivityTime; /// Time of the last interactive event that very likely modified the document. |