Skip to content

Commit

Permalink
update retry
Browse files Browse the repository at this point in the history
  • Loading branch information
f2calv committed Sep 30, 2024
1 parent 3875175 commit 52b6d37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="Google.Apis.Auth" Version="1.68.0" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="8.0.8" />
<PackageReference Include="MimeTypeMapOfficial" Version="1.0.17" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.9.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
Expand Down
13 changes: 8 additions & 5 deletions src/CasCap.Apis.GooglePhotos/Extensions/DI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ static void AddServices(this IServiceCollection services,
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
})
.AddTransientHttpErrorPolicy(policyBuilder =>
{
return policyBuilder.RetryAsync(retryCount: 3);
})
//https://github.com/aspnet/AspNetCore/issues/6804
.SetHandlerLifetime(Timeout.InfiniteTimeSpan);
.SetHandlerLifetime(Timeout.InfiniteTimeSpan)
.AddStandardResilienceHandler((options) =>
{
options.Retry = new Http.Resilience.HttpRetryStrategyOptions
{
Delay = TimeSpan.FromSeconds(30)
};
});
}
}

0 comments on commit 52b6d37

Please sign in to comment.