mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
fix computation of timeout for jobs to have proper bounds (min < max)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
09e60744c2
commit
032af80d4d
1 changed files with 4 additions and 3 deletions
|
@ -719,13 +719,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<qint64>(30 * 60 * 1000)));
|
||||
thirtyMinutes));
|
||||
}
|
||||
|
||||
void PropagateUploadFileCommon::slotJobDestroyed(QObject *job)
|
||||
|
|
Loading…
Reference in a new issue