[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/PrisonerSession.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 2 06:01:36 UTC 2017
wsd/DocumentBroker.cpp | 14 +++++++++-----
wsd/PrisonerSession.cpp | 4 ++--
2 files changed, 11 insertions(+), 7 deletions(-)
New commits:
commit 38bf731a9883f1d5ef4c086e72995f9b6d47c822
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jan 1 12:06:05 2017 -0500
wsd: simplify logging during save
Change-Id: Icdd790a555c301e285c9fa3a4eeff87aae2aec3e
Reviewed-on: https://gerrit.libreoffice.org/32610
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index edfcb42..6c42fd2 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -370,7 +370,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
const auto it = _sessions.find(sessionId);
if (it == _sessions.end())
{
- LOG_ERR("Session with sessionId [" << sessionId << "] not found while saving");
+ LOG_ERR("Session with sessionId [" << sessionId << "] not found while saving.");
return false;
}
@@ -437,8 +437,11 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
}
else if (storageSaveResult == StorageBase::SaveResult::DISKFULL)
{
- // Make everyone readonly and tell everyone that storage is low on diskspace
- for (auto& sessionIt : _sessions)
+ LOG_WRN("Disk full while saving [" << uri <<
+ "]. Making all sessions on doc read-only and notifying clients.");
+
+ // Make everyone readonly and tell everyone that storage is low on diskspace.
+ for (const auto& sessionIt : _sessions)
{
sessionIt.second->setReadOnly();
sessionIt.second->sendTextFrame("error: cmd=storage kind=savediskfull");
@@ -446,10 +449,11 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
}
else if (storageSaveResult == StorageBase::SaveResult::FAILED)
{
+ //TODO: Should we notify all clients?
+ LOG_ERR("Failed to save to URI [" << uri << "]. Notifying client.");
it->second->sendTextFrame("error: cmd=storage kind=savefailed");
}
- LOG_ERR("Failed to save to URI [" << uri << "].");
return false;
}
@@ -502,7 +506,7 @@ bool DocumentBroker::autoSave(const bool force, const size_t waitTimeoutMs, std:
LOG_TRC("Waiting for save event for [" << _docKey << "].");
if (_saveCV.wait_for(lock, std::chrono::milliseconds(waitTimeoutMs)) == std::cv_status::no_timeout)
{
- LOG_DBG("Successfully persisted document [" << _docKey << "] or document was not modified");
+ LOG_DBG("Successfully persisted document [" << _docKey << "] or document was not modified.");
return true;
}
diff --git a/wsd/PrisonerSession.cpp b/wsd/PrisonerSession.cpp
index c0d21a8..749ba79 100644
--- a/wsd/PrisonerSession.cpp
+++ b/wsd/PrisonerSession.cpp
@@ -84,8 +84,8 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
result = resultObj->get("value").toString();
}
- if (!_docBroker->save(getId(), success, result))
- LOG_ERR("Saving document to storage failed.");
+ // Save to Storage and log result.
+ _docBroker->save(getId(), success, result);
return true;
}
}
More information about the Libreoffice-commits
mailing list