< Summary

Information
Class: TeleFlow.Telegram.TelegramRetryAfterPolicy
Assembly: TeleFlow.Telegram.Client
File(s): /_/src/TeleFlow.Telegram.Client/TelegramRetryAfterPolicy.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 43
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
.ctor()100%11100%

File(s)

/_/src/TeleFlow.Telegram.Client/TelegramRetryAfterPolicy.cs

#LineLine coverage
 1namespace TeleFlow.Telegram;
 2
 3/// <summary>
 4/// Controls how the Telegram client reacts to Bot API throttling responses that include retry timing metadata.
 5/// This policy is used by the request executor for outgoing Bot API calls such as generated ctx.Bot.*Async methods.
 6/// </summary>
 7public sealed record class TelegramRetryAfterPolicy
 8{
 9    /// <summary>
 10    /// Production-safe default that retries one short Telegram throttling response before surfacing the error.
 11    /// </summary>
 112    public static TelegramRetryAfterPolicy Default { get; } = new()
 113    {
 114        Enabled = true,
 115        MaxRetries = 1,
 116        MaxDelay = TimeSpan.FromSeconds(5)
 117    };
 18
 19    /// <summary>
 20    /// Disables automatic retry-after waiting and surfaces Telegram throttling responses immediately.
 21    /// </summary>
 122    public static TelegramRetryAfterPolicy Disabled { get; } = new()
 123    {
 124        Enabled = false,
 125        MaxRetries = 0,
 126        MaxDelay = TimeSpan.FromSeconds(5)
 127    };
 28
 29    /// <summary>
 30    /// Gets whether automatic retry-after waiting is enabled.
 31    /// </summary>
 32    public bool Enabled { get; init; } = true;
 33
 34    /// <summary>
 35    /// Gets the maximum number of automatic retry attempts after the first throttled response.
 36    /// </summary>
 37    public int MaxRetries { get; init; } = 1;
 38
 39    /// <summary>
 40    /// Gets the maximum Telegram-requested delay that the executor may wait automatically.
 41    /// </summary>
 242    public TimeSpan MaxDelay { get; init; } = TimeSpan.FromSeconds(5);
 43}

Methods/Properties

.cctor()
.ctor()