MCPcopy Create free account
hub / github.com/coder/coder / Delay

Function Delay

coderd/x/chatd/chatretry/chatretry.go:42–51  ·  view source on GitHub ↗

Delay returns the backoff duration for the given 0-indexed attempt. Uses exponential backoff: min(InitialDelay * 2^attempt, MaxDelay). Matches the backoff curve used in coder/mux.

(attempt int)

Source from the content-addressed store, hash-verified

40// Uses exponential backoff: min(InitialDelay * 2^attempt, MaxDelay).
41// Matches the backoff curve used in coder/mux.
42func Delay(attempt int) time.Duration {
43 d := InitialDelay
44 for range attempt {
45 d *= 2
46 if d >= MaxDelay {
47 return MaxDelay
48 }
49 }
50 return d
51}
52
53// effectiveDelay returns the delay for the given 0-indexed attempt
54// while honoring any provider-supplied minimum retry delay.

Callers 5

TestDelayFunction · 0.92
effectiveDelayFunction · 0.85

Calls

no outgoing calls