Skip to content

Commit

Permalink
do not check every 5 seconds files with infinite timeout (= 0)
Browse files Browse the repository at this point in the history
we want to schedule a new sync attempt if a file is likely to have been
unlocked due to timeout expiring on server

but if the timeout is null (equal to 0), there will be no timeout on
server and no automated unlocking, so do not schedule a sync every 5
seconds to check for it

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Sep 14, 2023
1 parent b802451 commit d299e57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(const SyncFileItemPtr &it
}

// We want to check the lock state of this file after the lock time has expired
if(serverEntry.locked == SyncFileItem::LockStatus::LockedItem) {
if(serverEntry.locked == SyncFileItem::LockStatus::LockedItem && serverEntry.lockTimeout > 0) {
const auto lockExpirationTime = serverEntry.lockTime + serverEntry.lockTimeout;
const auto timeRemaining = QDateTime::currentDateTime().secsTo(QDateTime::fromSecsSinceEpoch(lockExpirationTime));
// Add on a second as a precaution, sometimes we catch the server before it has had a chance to update
Expand Down

0 comments on commit d299e57

Please sign in to comment.