summaryrefslogtreecommitdiffstats
path: root/common/synchronizer.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-13 14:25:10 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-13 14:25:10 +0200
commit02e69f585d489b413b57d6d5b1abcdc5b04d4371 (patch)
tree25439b5bf6ad622c946b296e05201f6c9a184ac4 /common/synchronizer.cpp
parente44295ca2005c81e17fcdfa1b9da44275f0a3e45 (diff)
downloadsink-02e69f585d489b413b57d6d5b1abcdc5b04d4371.tar.gz
sink-02e69f585d489b413b57d6d5b1abcdc5b04d4371.zip
Reduce the number of progress notifications for large sync sets.
We don't need an update for every mail if we download 50k mails. We just need enough to animate a progress bar.
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r--common/synchronizer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index 46d3980..959cf48 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -318,6 +318,10 @@ void Synchronizer::emitProgressNotification(Notification::NoticationType type, i
318void Synchronizer::reportProgress(int progress, int total, const QByteArrayList &entities) 318void Synchronizer::reportProgress(int progress, int total, const QByteArrayList &entities)
319{ 319{
320 if (progress > 0 && total > 0) { 320 if (progress > 0 && total > 0) {
321 //Limit progress updates for large amounts
322 if (total >= 100 && progress % 10 != 0) {
323 return;
324 }
321 SinkLogCtx(mLogCtx) << "Progress: " << progress << " out of " << total << mCurrentRequest.requestId << mCurrentRequest.applicableEntities; 325 SinkLogCtx(mLogCtx) << "Progress: " << progress << " out of " << total << mCurrentRequest.requestId << mCurrentRequest.applicableEntities;
322 const auto applicableEntities = [&] { 326 const auto applicableEntities = [&] {
323 if (entities.isEmpty()) { 327 if (entities.isEmpty()) {