diff --git a/Duplicati/Library/AutoUpdater/UpdaterManager.cs b/Duplicati/Library/AutoUpdater/UpdaterManager.cs index 490ce527b..5233fffcf 100644 --- a/Duplicati/Library/AutoUpdater/UpdaterManager.cs +++ b/Duplicati/Library/AutoUpdater/UpdaterManager.cs @@ -107,6 +107,16 @@ namespace Duplicati.Library.AutoUpdater /// public static UpdateInfo LastUpdateCheckVersion { get; private set; } + /// + /// The default timeout in seconds for download operations + /// + private const int DOWNLOAD_OPERATION_TIMEOUT_SECONDS = 3600; + + /// + /// The default timeout in seconds for fast get version metadata operations + /// + private const int SHORT_OPERATION_TIMEOUT_SECONDS = 30; + /// /// Performs static initialization of the update manager, populating the readonly fields of the manager /// @@ -325,8 +335,7 @@ namespace Duplicati.Library.AutoUpdater request.Headers.Add("X-Install-ID", InstallID); using var timeoutToken = new CancellationTokenSource(); - timeoutToken.CancelAfter(HttpContextSettings.ReadWriteTimeout); - + timeoutToken.CancelAfter(TimeSpan.FromSeconds(SHORT_OPERATION_TIMEOUT_SECONDS)); HttpClientHelper.DefaultClient.DownloadFile(request, tmpfile, null, timeoutToken.Token).ConfigureAwait(false).GetAwaiter().GetResult(); using (var fs = System.IO.File.OpenRead(tmpfile)) @@ -453,7 +462,7 @@ namespace Duplicati.Library.AutoUpdater request.Headers.Add("X-Install-ID", InstallID); using var timeoutToken = new CancellationTokenSource(); - timeoutToken.CancelAfter(HttpContextSettings.ReadWriteTimeout); + timeoutToken.CancelAfter(TimeSpan.FromSeconds(DOWNLOAD_OPERATION_TIMEOUT_SECONDS)); HttpClientHelper.DefaultClient.DownloadFile(request, tempfile, cb, timeoutToken.Token).ConfigureAwait(false).GetAwaiter().GetResult(); diff --git a/Duplicati/Library/UsageReporter/ReportSetUploader.cs b/Duplicati/Library/UsageReporter/ReportSetUploader.cs index 27aa857f4..b65a86fb3 100644 --- a/Duplicati/Library/UsageReporter/ReportSetUploader.cs +++ b/Duplicati/Library/UsageReporter/ReportSetUploader.cs @@ -49,6 +49,12 @@ namespace Duplicati.Library.UsageReporter /// private const string UPLOAD_URL = "https://usage-reporter.duplicati.com/api/v1/report"; + /// + /// The default timeout in seconds for report uploads + /// + private const int UPLOAD_OPERATION_TIMEOUT_SECONDS = 60; + + /// /// Runs the upload process /// @@ -83,7 +89,7 @@ namespace Duplicati.Library.UsageReporter request.Content = new StreamContent(fs); using var timeoutToken = new CancellationTokenSource(); - timeoutToken.CancelAfter(HttpContextSettings.ReadWriteTimeout); + timeoutToken.CancelAfter(TimeSpan.FromSeconds(UPLOAD_OPERATION_TIMEOUT_SECONDS)); var response = await HttpClientHelper.DefaultClient.UploadStream(request, timeoutToken.Token); rc = (int)response.StatusCode;