Skip to content

Commit a958eb8

Browse files
committed
fix(propagator): clean up logs related to item completed
each time an item is completed and the info is forwarded to activities model, we print an useless warning makes it more clear by improving a previous log with teh same info but better log level and make all our code to use teh same way to log completed items Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent be88433 commit a958eb8

5 files changed

Lines changed: 16 additions & 11 deletions

File tree

src/gui/tray/usermodel.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,6 @@ void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
16291629
return;
16301630
}
16311631

1632-
qCWarning(lcActivity) << "Item " << item->_file << " retrieved resulted in " << item->_errorString;
16331632
processCompletedSyncItem(folderInstance, item);
16341633
}
16351634

src/libsync/bulkpropagatordownloadjob.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ PropagatorJob::JobParallelism BulkPropagatorDownloadJob::parallelism() const
5959

6060
void BulkPropagatorDownloadJob::finalizeOneFile(const SyncFileItemPtr &file)
6161
{
62-
Q_EMIT propagator()->itemCompleted(file, ErrorCategory::GenericError);
62+
propagator()->emitItemCompleted(file, ErrorCategory::GenericError);
6363
}
6464

6565
void BulkPropagatorDownloadJob::start()
@@ -159,7 +159,7 @@ void BulkPropagatorDownloadJob::abortWithError(SyncFileItemPtr item, SyncFileIte
159159
if (item) {
160160
item->_errorString = error;
161161
item->_status = status;
162-
Q_EMIT propagator()->itemCompleted(item, ErrorCategory::GenericError);
162+
propagator()->emitItemCompleted(item, ErrorCategory::GenericError);
163163
}
164164
done(status);
165165
}

src/libsync/bulkpropagatorjob.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ void BulkPropagatorJob::done(SyncFileItemPtr item,
628628

629629
handleJobDoneErrors(item, status);
630630

631-
Q_EMIT propagator()->itemCompleted(item, category);
631+
propagator()->emitItemCompleted(item, category);
632632
}
633633

634634
QMap<QByteArray, QByteArray> BulkPropagatorJob::headers(SyncFileItemPtr item) const

src/libsync/owncloudpropagator.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,7 @@ void PropagateItemJob::done(const SyncFileItem::Status statusArg, const QString
276276
break;
277277
}
278278

279-
if (_item->hasErrorStatus()) {
280-
qCWarning(lcPropagator) << "Could not complete propagation of" << _item->destination() << "by" << this << "with status" << _item->_status << "and error:" << _item->_errorString;
281-
} else {
282-
qCInfo(lcPropagator) << "Completed propagation of" << _item->destination() << "by" << this << "with status" << _item->_status;
283-
}
284-
Q_EMIT propagator()->itemCompleted(_item, category);
279+
propagator()->emitItemCompleted(_item, category);
285280
Q_EMIT finished(_item->_status);
286281

287282
if (_item->_status == SyncFileItem::FatalError) {
@@ -928,6 +923,16 @@ void OwncloudPropagator::scheduleNextJobImpl()
928923
}
929924
}
930925

926+
void OwncloudPropagator::emitItemCompleted(const SyncFileItemPtr &item, ErrorCategory category)
927+
{
928+
if (item->hasErrorStatus()) {
929+
qCWarning(lcPropagator) << "Could not complete propagation of" << item->destination() << "by" << this << "with status" << item->_status << "and error:" << item->_errorString;
930+
} else {
931+
qCInfo(lcPropagator) << "Completed propagation of" << item->destination() << "by" << this << "with status" << item->_status;
932+
}
933+
Q_EMIT itemCompleted(item, category);
934+
}
935+
931936
void OwncloudPropagator::reportProgress(const SyncFileItem &item, qint64 bytes)
932937
{
933938
Q_EMIT progress(item, bytes);

src/libsync/owncloudpropagator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,9 @@ class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
641641

642642
[[nodiscard]] bool isInBulkUploadBlackList(const QString &file) const;
643643

644-
private Q_SLOTS:
644+
void emitItemCompleted(const OCC::SyncFileItemPtr &item, OCC::ErrorCategory category);
645645

646+
private Q_SLOTS:
646647
void abortTimeout()
647648
{
648649
// Abort synchronously and finish

0 commit comments

Comments
 (0)