< Summary - AsyncResponse (Release / net8.0+net10.0 / unit+integration)

Information
Class: AsyncResponse.Internal.PostgreSqlTransientFaults
Assembly: AsyncResponse.Transports.PostgreSQL
File(s): /_/src/Shared/PostgreSqlTransientFaults.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 21
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsTransient(...)100%66100%

File(s)

/_/src/Shared/PostgreSqlTransientFaults.cs

#LineLine coverage
 1using Npgsql;
 2
 3namespace AsyncResponse.Internal;
 4
 5/// <summary>
 6/// Classifies PostgreSQL errors worth retrying. Npgsql already curates the set through
 7/// <see cref="NpgsqlException.IsTransient"/> (connection breaks, serialization/deadlock SQLSTATEs,
 8/// admin shutdowns), so this only adds the driver-independent client-side timeout and excludes
 9/// cancellation. Source-linked into the PostgreSQL channel and transport packages (separate
 10/// packages cannot share compiled code), so both retry the same set.
 11/// </summary>
 12internal static class PostgreSqlTransientFaults
 13{
 14    /// <summary>
 15    /// The predicate the retry loops pass to <c>AsyncResponseRetry</c>. Cancellation is excluded
 16    /// first: a token trip is the caller's decision, never a fault to retry.
 17    /// </summary>
 18    public static bool IsTransient(Exception exception)
 2419        => exception is not OperationCanceledException
 2420           && (exception is NpgsqlException { IsTransient: true } || exception is TimeoutException);
 21}

Methods/Properties

IsTransient(System.Exception)