aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/syncjob.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-03 10:49:26 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-03 11:06:12 +0900
commit47f27816c401a6cc15fb13607658aee716a2eb2c (patch)
treed3fb545de2b04d4e72616c39382712d2bc487859 /lib/jobs/syncjob.cpp
parente0ef2b8bd9e2ef9ea978e22e587cf8f50a01639b (diff)
downloadlibquotient-47f27816c401a6cc15fb13607658aee716a2eb2c.tar.gz
libquotient-47f27816c401a6cc15fb13607658aee716a2eb2c.zip
SyncJob: log sync data statistics better
Diffstat (limited to 'lib/jobs/syncjob.cpp')
-rw-r--r--lib/jobs/syncjob.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/jobs/syncjob.cpp b/lib/jobs/syncjob.cpp
index a366cece..f9f5666e 100644
--- a/lib/jobs/syncjob.cpp
+++ b/lib/jobs/syncjob.cpp
@@ -92,17 +92,26 @@ BaseJob::Status SyncData::parseJson(const QJsonDocument &data)
QJsonObject rooms = json.value("rooms").toObject();
JoinStates::Int ii = 1; // ii is used to make a JoinState value
+ auto totalRooms = 0;
+ auto totalEvents = 0;
for (size_t i = 0; i < JoinStateStrings.size(); ++i, ii <<= 1)
{
const auto rs = rooms.value(JoinStateStrings[i]).toObject();
// We have a Qt container on the right and an STL one on the left
roomData.reserve(static_cast<size_t>(rs.size()));
for(auto roomIt = rs.begin(); roomIt != rs.end(); ++roomIt)
+ {
roomData.emplace_back(roomIt.key(), JoinState(ii),
roomIt.value().toObject());
+ const auto& r = roomData.back();
+ totalEvents += r.state.size() + r.ephemeral.size() +
+ r.accountData.size() + r.timeline.size();
+ }
+ totalRooms += roomData.size();
}
qCDebug(PROFILER) << "*** SyncData::parseJson(): batch with"
- << rooms.size() << "room(s) in" << et;
+ << totalRooms << "room(s),"
+ << totalEvents << "event(s) in" << et;
return BaseJob::Success;
}