relay.

Changelog

Notable changes to relay. This project follows semantic versioning; the v1 line keeps the documented API stable.

v1.2.1

2025-05-12 Fix
  • Fixed a race in the breaker's half-open probe where two concurrent calls could both be admitted under high contention.
  • Corrected backoff overflow when Base was very large and the attempt count was high; the computed delay now saturates at Max instead of wrapping.

v1.2.0

2025-04-28 Feature
  • Added Client.State() to inspect the current breaker state for health checks and metrics.
  • Added EqualJitter as a built-in JitterFunc.
  • Documented the body-rewind requirement for retrying non-standard request bodies.

v1.1.3

2025-03-09 Fix
  • Per-attempt timeout is now correctly cancelled after each attempt, fixing a context leak observed under sustained load.
  • Minor documentation fixes in the configuration guide.

v1.1.2

2025-02-17 Fix
  • RetryIdempotent no longer retries POST requests that were misclassified when a custom method string was used.
  • Reduced allocations on the non-retry fast path.

v1.1.0

2025-01-22 Feature
  • Added ConstantBackoff for fixed-delay retry schedules.
  • ErrExhausted now wraps the final underlying error so errors.Unwrap reveals the last cause.
  • The breaker's SuccessThreshold is now configurable (previously fixed at 1).

v1.0.1

2024-12-30 Fix
  • Fixed a nil-pointer panic when RetryPolicy.RetryOn was left nil; it now falls back to RetryIdempotent as documented.

v1.0.0

2024-12-03 Feature Breaking
  • First stable release. The v1 API is now frozen.
  • Breaking: New takes functional options instead of a Config struct. Migrate relay.NewWithConfig(cfg) to the equivalent With* options.
  • Breaking: Client.Do now takes context.Context as its first parameter.
  • Established the three-layer model: breaker, then retry, then per-attempt timeout.

v0.5.2

2024-10-15 Fix
  • Full jitter is now applied correctly; earlier builds applied jitter to only the first retry.
  • Clarified that clients are safe for concurrent use.

v0.5.0

2024-09-27 Feature
  • Introduced the circuit breaker with closed/open/half-open states.
  • Added WithCircuitBreaker and ErrCircuitOpen.

v0.4.1

2024-08-19 Fix
  • Backoff now respects the parent context deadline instead of sleeping past it.

v0.4.0

2024-07-30 Feature
  • Added the Backoff interface with ExponentialBackoff and pluggable jitter.
  • Request bodies are rewound via GetBody before each retry.

v0.3.0

2024-06-24 Feature
  • Added per-attempt timeouts via WithTimeout.
  • Added the RetryIdempotent and RetryNever classifiers.

v0.2.0

2024-06-02 Feature
  • Added bounded retries with a fixed delay.
  • Get and Post convenience helpers.

v0.1.0

2024-05-14 Feature
  • Initial public release: a thin wrapper over net/http with a single Do method and a configurable transport.