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