v1.2.1
Three bug fixes in transport behaviour and a small set of godoc clarifications.
No API surface changes, no new dependencies.
Fixed
retry.Transport: whenRetry-Afterexceeds the configuredmaxDelay,
the prior 5xx response is now drained and closed inside the transport and
the call returns(nil, ErrRetryAfterExceedsMax). Previously the
transport returned(resp, err)withresp.Bodyopen, which violated
thehttp.RoundTrippercontract that a non-nil error implies the caller
has nothing to close. When wrapped byhttp.Client(the standard
ghkit.Newpath), the response was dropped unclosed, leaking the body
and preventing connection reuse on every aborted retry.etag.Transportdrift recovery: the post-cooldown probe predicate
shifted fromn%driftProbeEveryN == 0ton%driftProbeEveryN == 1.
Probes now fire on calls 1, 51, 101 afterdriftCooldownelapses (was
50, 100, 150), shifting the probe burst to the start of the post-cooldown
window and cutting recovery latency from 150 to 101 cacheable requests.etag.NewLRUCache:byteTotalaccounting now decrements on count-cap
evictions via a registered eviction callback. Previously, when the LRU's
internal slot cap (default 4096) overflowed and the eldest entry was
evicted,byteTotalwas not adjusted; on workloads with more than 4096
distinct cached entries combined withWithMaxCacheBytes, the
over-counted total made the byte-budget loop evict real entries to
compensate for phantom bytes, shrinking effective cache capacity.
Documentation
retry.ErrRetryAfterExceedsMaxgodoc records the new contract: on this
errorrespisniland the transport has already drained and closed
the prior response.etag.WithKeyScopegodoc clarifies that an empty scope is treated
identically to omitting the option, and that combiningWithCachewith
no scope fails construction withErrKeyScopeRequired.ratelimit.WithUpstreamOptionsgodoc warns that type-mismatched values
are silently dropped by the upstream constructor.etagpackage doc records the drift detector's tuning assumption: a
transport handling fewer than roughly 100 cacheable requests after the
cooldown window elapses will not complete recovery under the current
private thresholds.ghkit.HTTPClientcomposition-order comment now lists theretrylayer
betweenoauth2andratelimit, matching the actual code.- README retry recipe updated to match the new abort contract and to note
that POST/PATCH retries with a body requirereq.GetBody.