diff --git a/core/backends/lan/compositeuploadjob.cpp b/core/backends/lan/compositeuploadjob.cpp index 581cc849b..3d38fdcee 100644 --- a/core/backends/lan/compositeuploadjob.cpp +++ b/core/backends/lan/compositeuploadjob.cpp @@ -39,6 +39,7 @@ CompositeUploadJob::CompositeUploadJob(const QString& deviceId, bool displayNoti , m_totalSendPayloadSize(0) , m_totalPayloadSize(0) , m_currentJob(nullptr) + , m_prevElapsedTime(0) { setCapabilities(Killable); @@ -226,13 +227,16 @@ void CompositeUploadJob::slotProcessedAmount(KJob *job, KJob::Unit unit, qulongl Q_UNUSED(job); m_currentJobSendPayloadSize = amount; - quint64 uploaded = m_totalSendPayloadSize + m_currentJobSendPayloadSize; - setProcessedAmount(unit, uploaded); - const auto elapsed = m_timer.elapsed(); - if (elapsed > 0) { - emitSpeed((1000 * uploaded) / elapsed); + if (uploaded == m_totalPayloadSize || m_prevElapsedTime == 0 || m_timer.elapsed() - m_prevElapsedTime >= 100) { + m_prevElapsedTime = m_timer.elapsed(); + setProcessedAmount(unit, uploaded); + + const auto elapsed = m_timer.elapsed(); + if (elapsed > 0) { + emitSpeed((1000 * uploaded) / elapsed); + } } } diff --git a/core/backends/lan/compositeuploadjob.h b/core/backends/lan/compositeuploadjob.h index d4d65d871..d0a2d01e6 100644 --- a/core/backends/lan/compositeuploadjob.h +++ b/core/backends/lan/compositeuploadjob.h @@ -66,6 +66,7 @@ private: quint64 m_totalPayloadSize; UploadJob *m_currentJob; QElapsedTimer m_timer; + quint64 m_prevElapsedTime; const static quint16 MIN_PORT = 1739; const static quint16 MAX_PORT = 1764;