Documentation
¶
Overview ¶
Package backoff는 공용 exponential backoff helper를 제공합니다.
이 패키지는 호출부가 상태 기반 또는 attempt 기반 exponential backoff 값을 계산할 때 사용할 수 있는 작은 순수 helper를 제공합니다. 실제 sleep, retry loop, context 제어는 호출부 책임으로 둡니다.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeExponentialBackoff ¶
ComputeExponentialBackoff는 attempt 번호를 기반으로 base*2^attempt 지연값을 계산합니다.
func ComputeExponentialBackoffHalfJitter ¶
func ComputeExponentialBackoffHalfJitter(attempt int, base, maxInterval time.Duration) time.Duration
ComputeExponentialBackoffHalfJitter는 base*2^attempt를 maxInterval로 cap한 값(cap)에 대해 [cap/2, cap) 범위의 backoff 값을 반환합니다. cap이 1보다 작거나 같은 극단적 케이스에서는 jitter가 의미 없어 cap 그대로 반환합니다. 분포는 cbgk legacy retryDelay/consumerRetryDelay와 통계적으로 동등합니다 (홀수 cap에서는 본 함수가 상한 1 unit을 추가로 포함해 약간 더 균등하지만 production duration 규모에서는 ±5% 이내).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.