do not check every 5 seconds files with infinite timeout (= 0)

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>
This commit is contained in:
Matthieu Gallien 2023-09-14 18:27:18 +02:00
Родитель e0103918ce
Коммит a17b3608d9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7D0F74F05C22F553
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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