wsd: improve logging and doc state dumping

Change-Id: I62ae4cc8dd52861ce550217fb5fa96405cbe4eed
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 644ca92d289d77d4e14a6a473ed55daedbb125d7)
This commit is contained in:
Ashod Nakashian 2022-01-05 13:47:05 -05:00 committed by Jan Holesovsky
parent ff43f8626f
commit e0e988c56c

View file

@ -1104,9 +1104,16 @@ DocumentBroker::NeedToUpload DocumentBroker::needToUploadToStorage() const
// Get the modified-time of the file on disk.
const auto st = FileUtil::Stat(_storage->getRootFilePathUploading());
const std::chrono::system_clock::time_point currentModifiedTime = st.modifiedTimepoint();
const std::chrono::system_clock::time_point lastModifiedTime =
_storageManager.getLastUploadedFileModifiedTime();
LOG_TRC("File to upload to storage ["
<< _storage->getRootFilePathUploading() << "] was modified at " << currentModifiedTime
<< " and the last uploaded file was modified at " << lastModifiedTime << ", which are "
<< (currentModifiedTime == lastModifiedTime ? "identical." : "different."));
// Compare to the last uploaded file's modified-time.
if (currentModifiedTime != _storageManager.getLastUploadedFileModifiedTime())
if (currentModifiedTime != lastModifiedTime)
return NeedToUpload::Yes; // Timestamp changed, upload.
return NeedToUpload::No; // No reason to upload, seems up-to-date.
@ -3343,6 +3350,7 @@ void DocumentBroker::dumpState(std::ostream& os)
os << "\n doc id: " << _docId;
os << "\n num sessions: " << _sessions.size();
os << "\n thread start: " << Util::getSteadyClockAsString(_threadStart);
os << "\n possibly-modified: " << isPossiblyModified();
os << "\n doc state: " << DocumentState::toString(_docState.status());
os << "\n doc activity: " << DocumentState::toString(_docState.activity());
if (_docState.activity() == DocumentState::Activity::Rename)
@ -3353,6 +3361,7 @@ void DocumentBroker::dumpState(std::ostream& os)
<< Util::getSteadyClockAsString(_saveManager.lastSaveRequestTime());
os << "\n last save response: "
<< Util::getSteadyClockAsString(_saveManager.lastSaveResponseTime());
os << "\n last save successful: " << _saveManager.lastSaveSuccessful();
os << "\n last storage upload was successful: " << isLastStorageUploadSuccessful();
os << "\n last modified: " << Util::getHttpTime(_storageManager.getLastModifiedTime());
os << "\n file last modified: " << Util::getHttpTime(_saveManager.getLastModifiedTime());