Skip to content

Commit a34b55b

Browse files
committed
fix(lockedFiles): ensure locked files seen during discovery are known
will ensure we watch them and sync them as soon as they are no longer locked Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent 5a6ea43 commit a34b55b

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/libsync/discovery.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
262262
if (OCC::FileSystem::isFileLocked(_discoveryData->_localDir + path, OCC::FileSystem::LockMode::SharedRead)) {
263263
qCInfo(lcDisco) << _discoveryData->_localDir + path << "is locked" << "exluding it from sync";
264264
excluded = CSYNC_FILE_SILENTLY_EXCLUDED;
265+
266+
emit _discoveryData->seenLockedFile(path);
265267
}
266268

267269
const auto fileName = path.mid(path.lastIndexOf('/') + 1);

src/libsync/discoveryphase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ class DiscoveryPhase : public QObject
345345
void addErrorToGui(const OCC::SyncFileItem::Status status, const QString &errorMessage, const QString &subject, const OCC::ErrorCategory category);
346346

347347
void remnantReadOnlyFolderDiscovered(const OCC::SyncFileItemPtr &item);
348+
349+
/** Emitted when propagation would have problems with a locked file. */
350+
void seenLockedFile(const QString &fileName);
348351
private slots:
349352
void slotItemDiscovered(const OCC::SyncFileItemPtr &item);
350353
};

src/libsync/syncengine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ void SyncEngine::startSync()
708708
connect(_discoveryPhase.get(), &DiscoveryPhase::silentlyExcluded,
709709
_syncFileStatusTracker.data(), &SyncFileStatusTracker::slotAddSilentlyExcluded);
710710
connect(_discoveryPhase.get(), &DiscoveryPhase::remnantReadOnlyFolderDiscovered, this, &SyncEngine::remnantReadOnlyFolderDiscovered);
711+
connect(_discoveryPhase.get(), &DiscoveryPhase::seenLockedFile, this, &SyncEngine::seenLockedFile);
711712

712713
ProcessDirectoryJob *discoveryJob = nullptr;
713714

0 commit comments

Comments
 (0)