Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
aannenko committed Oct 7, 2024
1 parent c6549d8 commit 6888f2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/TransmissionManager.Database/Services/AppDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace TransmissionManager.Database.Services;

[SuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The app is thoroughly tested after trimming, that includes the used EF Core functionality")]
[SuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "Tested after trimming, including the used EF Core functionality")]
public sealed class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
public DbSet<Torrent> Torrents { get; set; }
public DbSet<Torrent> Torrents => Set<Torrent>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,14 @@ private static void ConfigureHttpClient(IServiceProvider services, HttpClient cl

private static void ConfigureResilience(ResiliencePipelineBuilder<HttpResponseMessage> builder)
{
builder.AddRetry(
new()
builder
.AddRetry(new()
{
ShouldHandle = new PredicateBuilder<HttpResponseMessage>()
.HandleResult(static response => response is
{
IsSuccessStatusCode: false,
StatusCode: not HttpStatusCode.Conflict,
})
});
ShouldHandle = new PredicateBuilder<HttpResponseMessage>().HandleResult(IsRetriableResponse)
})
.AddTimeout(TimeSpan.FromSeconds(3));

builder.AddTimeout(TimeSpan.FromSeconds(3));
static bool IsRetriableResponse(HttpResponseMessage response) =>
response is { IsSuccessStatusCode: false, StatusCode: not HttpStatusCode.Conflict };
}
}

0 comments on commit 6888f2c

Please sign in to comment.