Skip to content

Commit 06f2add

Browse files
committed
perf(logging): reduce logging overhead in hot paths
- Remove dead debug lambda in PUTFileJob::start() that constructed a temporary QLoggingCategory on every upload progress tick. The signal is already connected to the proper handler on the next line. - Add QtInfoMsg default to 3 Q_LOGGING_CATEGORY declarations that were missing it, preventing debug-level output from being active by default. - Remove tr() and QString::number() allocations from a qCDebug call in usermodel.cpp quota update path. Signed-off-by: Qoole <2862661+qoole@users.noreply.github.com>
1 parent 9ac8d75 commit 06f2add

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/gui/tray/usermodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,7 @@ void User::slotQuotaChanged(const int64_t &usedBytes, const int64_t &availableBy
18231823

18241824
const auto percent = (double)usedBytes / (double)total * 100.0;
18251825
const auto percentInt = qMin(qRound(percent), 100);
1826-
qCDebug(lcActivity) << tr("Quota is updated; %1 percent of the total space is used.").arg(QString::number(percentInt));
1826+
qCDebug(lcActivity) << "Quota updated:" << percentInt << "% used";
18271827

18281828
int thresholdPassed = 0;
18291829
if (_lastQuotaPercent < 80 && percentInt >= 80) {

src/libsync/basepropagateremotedeleteencrypted.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "deletejob.h"
1313
#include "owncloudpropagator.h"
1414

15-
Q_LOGGING_CATEGORY(ABSTRACT_PROPAGATE_REMOVE_ENCRYPTED, "nextcloud.sync.propagator.remove.encrypted")
15+
Q_LOGGING_CATEGORY(ABSTRACT_PROPAGATE_REMOVE_ENCRYPTED, "nextcloud.sync.propagator.remove.encrypted", QtInfoMsg)
1616

1717
namespace OCC {
1818

src/libsync/propagateremotedeleteencrypted.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
using namespace OCC;
1515

16-
Q_LOGGING_CATEGORY(PROPAGATE_REMOVE_ENCRYPTED, "nextcloud.sync.propagator.remove.encrypted")
16+
Q_LOGGING_CATEGORY(PROPAGATE_REMOVE_ENCRYPTED, "nextcloud.sync.propagator.remove.encrypted", QtInfoMsg)
1717

1818
PropagateRemoteDeleteEncrypted::PropagateRemoteDeleteEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item, QObject *parent)
1919
: BasePropagateRemoteDeleteEncrypted(propagator, item, parent)

src/libsync/propagateremotedeleteencryptedrootfolder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace {
3131

3232
using namespace OCC;
3333

34-
Q_LOGGING_CATEGORY(PROPAGATE_REMOVE_ENCRYPTED_ROOTFOLDER, "nextcloud.sync.propagator.remove.encrypted.rootfolder")
34+
Q_LOGGING_CATEGORY(PROPAGATE_REMOVE_ENCRYPTED_ROOTFOLDER, "nextcloud.sync.propagator.remove.encrypted.rootfolder", QtInfoMsg)
3535

3636
PropagateRemoteDeleteEncryptedRootFolder::PropagateRemoteDeleteEncryptedRootFolder(OwncloudPropagator *propagator, SyncFileItemPtr item, QObject *parent)
3737
: BasePropagateRemoteDeleteEncrypted(propagator, item, parent)

0 commit comments

Comments
 (0)