diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 14:25:10 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 14:25:10 +0200 |
commit | 02e69f585d489b413b57d6d5b1abcdc5b04d4371 (patch) | |
tree | 25439b5bf6ad622c946b296e05201f6c9a184ac4 | |
parent | e44295ca2005c81e17fcdfa1b9da44275f0a3e45 (diff) | |
download | sink-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.
-rw-r--r-- | common/synchronizer.cpp | 4 |
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 | |||
318 | void Synchronizer::reportProgress(int progress, int total, const QByteArrayList &entities) | 318 | void 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()) { |