mirror of
https://github.com/EpicMorg/atlassian-downloader.git
synced 2025-01-12 11:47:55 +03:00
2.0.0.2
This commit is contained in:
parent
b4e881a1d7
commit
6063467e2d
@ -1,6 +1,9 @@
|
||||
# Atlassian Downloader - Changelog
|
||||
|
||||
## 2.x
|
||||
* `2.0.0.2` - - minor update:
|
||||
* Added `maxRetries (default: 5)` and `delayBetweenRetries (default: 2500, milliseconds)` args, to redownload file if connection will be reset.
|
||||
* Updated dependencies.
|
||||
* `2.0.0.1` - - minor update:
|
||||
* Fix default output dir, enable nullables, fix compiler warnings #43
|
||||
* Remove redundant parameters from publish profiles #42
|
||||
|
@ -212,6 +212,8 @@ internal class DownloaderService : IHostedService
|
||||
}
|
||||
|
||||
private async Task DownloadFile(ResponseItem file, string outputFile, CancellationToken cancellationToken)
|
||||
{
|
||||
for (int attempt = 1; attempt <= options.MaxRetries; attempt++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(file.Md5))
|
||||
{
|
||||
@ -225,6 +227,10 @@ internal class DownloaderService : IHostedService
|
||||
await request.CopyToAsync(outputStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception downloadEx)
|
||||
{
|
||||
this.logger.LogError(downloadEx, "Attempt {attempt} failed to download file \"{uri}\" to \"{outputFile}\".", attempt, file.ZipUrl, outputFile);
|
||||
|
||||
if (attempt == options.MaxRetries)
|
||||
{
|
||||
this.logger.LogError(downloadEx, "Failed to download file \"{uri}\" to \"{outputFile}\".", file.ZipUrl, outputFile);
|
||||
try
|
||||
@ -235,10 +241,16 @@ internal class DownloaderService : IHostedService
|
||||
{
|
||||
this.logger.LogError(removeEx, "Failed to remove incomplete file \"{outputFile}\".", outputFile);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(options.DelayBetweenRetries, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.LogInformation("File \"{uri}\" successfully downloaded to \"{outputFile}\".", file.ZipUrl, outputFile);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
public async Task StopAsync(CancellationToken cancellationToken) { }
|
||||
|
@ -8,4 +8,7 @@ public record DownloaderOptions(
|
||||
bool Version,
|
||||
string? ProductVersion,
|
||||
bool SkipFileCheck,
|
||||
string UserAgent) { }
|
||||
string UserAgent,
|
||||
int MaxRetries,
|
||||
int DelayBetweenRetries
|
||||
) { }
|
@ -24,6 +24,8 @@ public class Program
|
||||
/// <param name="productVersion">Override target version to download some product. Advice: Use it with "customFeed".</param>
|
||||
/// <param name="skipFileCheck">Skip compare of file sizes if a local file already exists. Existing file will be skipped to check and redownload.</param>
|
||||
/// <param name="userAgent">Set custom user agent via this feature flag.</param>
|
||||
/// <param name="maxRetries">Set custom count of download retries.</param>
|
||||
/// <param name="delayBetweenRetries">Set custom delay between retries (in milliseconds).</param>
|
||||
static async Task Main(
|
||||
string? outputDir = default,
|
||||
Uri[]? customFeed = null,
|
||||
@ -31,6 +33,8 @@ public class Program
|
||||
bool about = false,
|
||||
string? productVersion = null,
|
||||
bool skipFileCheck = false,
|
||||
int maxRetries = 5,
|
||||
int delayBetweenRetries = 2500,
|
||||
string userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0") => await
|
||||
Host
|
||||
.CreateDefaultBuilder()
|
||||
@ -60,7 +64,9 @@ public class Program
|
||||
about,
|
||||
productVersion,
|
||||
skipFileCheck,
|
||||
userAgent))
|
||||
userAgent,
|
||||
maxRetries,
|
||||
delayBetweenRetries))
|
||||
.AddHttpClient())
|
||||
.RunConsoleAsync()
|
||||
.ConfigureAwait(false);
|
||||
|
@ -12,6 +12,7 @@
|
||||
<!--build props-->
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
@ -26,25 +27,25 @@
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
|
||||
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
|
||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||
<FileVersion>2.0.0.0</FileVersion>
|
||||
<Version>2.0.0.0</Version>
|
||||
<Copyright>EpicMorg 2023</Copyright>
|
||||
<AssemblyVersion>2.0.0.2</AssemblyVersion>
|
||||
<FileVersion>2.0.0.2</FileVersion>
|
||||
<Version>2.0.0.2</Version>
|
||||
<Copyright>EpicMorg 2024</Copyright>
|
||||
<Product>Atlassian Downloader</Product>
|
||||
<Company>EpicMorg</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RootNamespace>EpicMorg.Atlassian.Downloader</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.2.23479.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0-rc.2.23479.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0-rc.2.23479.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0-rc.2.23479.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-rc.2.23479.6" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.1-dev-10354" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.2-dev-00546" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.2.0-dev-00918" />
|
||||
<PackageReference Include="Serilog" Version="3.1.0-dev-02078" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.4.0-alpha.22272.1" />
|
||||
<None Include="..\README.md">
|
||||
<Pack>True</Pack>
|
||||
|
Loading…
x
Reference in New Issue
Block a user