diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index ca08042eeaf20..50eba10f1fa75 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -709,13 +709,14 @@ void PropagateUploadFileCommon::commonErrorHandling(AbstractNetworkJob *job) void PropagateUploadFileCommon::adjustLastJobTimeout(AbstractNetworkJob *job, qint64 fileSize) { constexpr double threeMinutes = 3.0 * 60 * 1000; + constexpr qint64 thirtyMinutes = 30 * 60 * 1000; job->setTimeout(qBound( - job->timeoutMsec(), // Calculate 3 minutes for each gigabyte of data - qRound64(threeMinutes * fileSize / 1e9), + qMin(thirtyMinutes - 1, qRound64(threeMinutes * fileSize / 1e9)), + job->timeoutMsec(), // Maximum of 30 minutes - static_cast(30 * 60 * 1000))); + thirtyMinutes)); } void PropagateUploadFileCommon::slotJobDestroyed(QObject *job)