Table of Contents

Class RetryPolicy

Namespace
OpenShell
Assembly
OpenShell.Sdk.dll

Retries transient gateway failures with exponential backoff and jitter. Only unary calls are retried here; streaming operations such as watches reconnect on their own.

public sealed record RetryPolicy : IEquatable<RetryPolicy>
Inheritance
RetryPolicy
Implements
Inherited Members

Properties

BackoffMultiplier

Growth factor between delays.

public double BackoffMultiplier { get; init; }

Property Value

double

Default

A sensible default: up to 4 attempts for idempotent reads on Unavailable.

public static RetryPolicy Default { get; }

Property Value

RetryPolicy

InitialBackoff

Delay before the first retry.

public TimeSpan InitialBackoff { get; init; }

Property Value

TimeSpan

IsIdempotent

Decides whether an RPC is safe to repeat, given its name (for example GetSandbox). The default repeats reads: Get*, List* and Health. Writes are never repeated by default because a lost response could duplicate a side effect; supply request ids and widen this predicate to opt in.

public Func<string, bool> IsIdempotent { get; init; }

Property Value

Func<string, bool>

Jitter

Fraction (0 to 1) of each delay that is randomized, to avoid synchronized retries.

public double Jitter { get; init; }

Property Value

double

MaxAttempts

Total attempts including the first. 1 disables retries.

public int MaxAttempts { get; init; }

Property Value

int

MaxBackoff

Upper bound for any single delay.

public TimeSpan MaxBackoff { get; init; }

Property Value

TimeSpan

None

No retries.

public static RetryPolicy None { get; }

Property Value

RetryPolicy

RetryableStatusCodes

Status codes worth retrying. Defaults to Unavailable only.

public IReadOnlySet<StatusCode> RetryableStatusCodes { get; init; }

Property Value

IReadOnlySet<StatusCode>