diff options
author | alex-z <blackslayer4@gmail.com> | 2022-08-04 14:10:06 +0300 |
---|---|---|
committer | Matthieu Gallien <matthieu_gallien@yahoo.fr> | 2022-09-17 10:47:15 +0300 |
commit | e1c4e23d201b3cc75df966eb5cc74ad65c8c903f (patch) | |
tree | 57f6e1471c3dd06765962029f61b2ca715e7dfcf /src | |
parent | 90c94c9d59aed90e16f2de0ebe6490dce050fe35 (diff) |
Do not ignore return value of SyncJournalDB in syncengine.
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libsync/syncengine.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 25ad7072e..2f0b8eda8 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -268,7 +268,9 @@ void SyncEngine::deleteStaleErrorBlacklistEntries(const SyncFileItemVector &sync } // Delete from journal. - _journal->deleteStaleErrorBlacklistEntries(blacklist_file_paths); + if (!_journal->deleteStaleErrorBlacklistEntries(blacklist_file_paths)) { + qCWarning(lcEngine) << "Could not delete StaleErrorBlacklistEntries from DB"; + } } #if (QT_VERSION < 0x050600) @@ -378,13 +380,20 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item) } // Updating the db happens on success - _journal->setFileRecord(rec); + if (!_journal->setFileRecord(rec)) { + item->_status = SyncFileItem::Status::NormalError; + item->_instruction = CSYNC_INSTRUCTION_ERROR; + item->_errorString = tr("Could not set file record to local DB: %1").arg(rec.path()); + qCWarning(lcEngine) << "Could not set file record to local DB" << rec.path(); + } // This might have changed the shared flag, so we must notify SyncFileStatusTracker for example emit itemCompleted(item); } else { // Update only outdated data from the disk. - _journal->updateLocalMetadata(item->_file, item->_modtime, item->_size, item->_inode); + if (!_journal->updateLocalMetadata(item->_file, item->_modtime, item->_size, item->_inode)) { + qCWarning(lcEngine) << "Could not update local metadata for file" << item->_file; + } } _hasNoneFiles = true; return; @@ -1014,12 +1023,14 @@ bool SyncEngine::shouldDiscoverLocally(const QString &path) const void SyncEngine::wipeVirtualFiles(const QString &localPath, SyncJournalDb &journal, Vfs &vfs) { qCInfo(lcEngine) << "Wiping virtual files inside" << localPath; - journal.getFilesBelowPath(QByteArray(), [&](const SyncJournalFileRecord &rec) { + const auto resGetFilesBelowPath = journal.getFilesBelowPath(QByteArray(), [&](const SyncJournalFileRecord &rec) { if (rec._type != ItemTypeVirtualFile && rec._type != ItemTypeVirtualFileDownload) return; qCDebug(lcEngine) << "Removing db record for" << rec.path(); - journal.deleteFileRecord(rec._path); + if (!journal.deleteFileRecord(rec._path)) { + qCWarning(lcEngine) << "Could not update delete file record" << rec._path; + } // If the local file is a dehydrated placeholder, wipe it too. // Otherwise leave it to allow the next sync to have a new-new conflict. @@ -1030,6 +1041,10 @@ void SyncEngine::wipeVirtualFiles(const QString &localPath, SyncJournalDb &journ } }); + if (!resGetFilesBelowPath) { + qCWarning(lcEngine) << "Faied to get files below path" << localPath; + } + journal.forceRemoteDiscoveryNextSync(); // Postcondition: No ItemTypeVirtualFile / ItemTypeVirtualFileDownload left in the db. @@ -1039,7 +1054,7 @@ void SyncEngine::wipeVirtualFiles(const QString &localPath, SyncJournalDb &journ void SyncEngine::switchToVirtualFiles(const QString &localPath, SyncJournalDb &journal, Vfs &vfs) { qCInfo(lcEngine) << "Convert to virtual files inside" << localPath; - journal.getFilesBelowPath({}, [&](const SyncJournalFileRecord &rec) { + const auto res = journal.getFilesBelowPath({}, [&](const SyncJournalFileRecord &rec) { const auto path = rec.path(); const auto fileName = QFileInfo(path).fileName(); if (FileSystem::isExcludeFile(fileName)) { @@ -1052,6 +1067,10 @@ void SyncEngine::switchToVirtualFiles(const QString &localPath, SyncJournalDb &j qCWarning(lcEngine) << "Could not convert file to placeholder" << result.error(); } }); + + if (!res) { + qCWarning(lcEngine) << "Faied to get files below path" << localPath; + } } void SyncEngine::abort() |