MCPcopy Index your code
hub / github.com/coder/coder / GetProgressiveInterval

Function GetProgressiveInterval

cli/cliui/agent.go:399–412  ·  view source on GitHub ↗

GetProgressiveInterval returns an interval that increases over time. The interval starts at baseInterval and increases to a maximum of baseInterval * 16 over time.

(baseInterval time.Duration, elapsed time.Duration)

Source from the content-addressed store, hash-verified

397// The interval starts at baseInterval and increases to
398// a maximum of baseInterval * 16 over time.
399func GetProgressiveInterval(baseInterval time.Duration, elapsed time.Duration) time.Duration {
400 switch {
401 case elapsed < 60*time.Second:
402 return baseInterval // 500ms for first 60 seconds
403 case elapsed < 2*time.Minute:
404 return baseInterval * 2 // 1s for next 1 minute
405 case elapsed < 5*time.Minute:
406 return baseInterval * 4 // 2s for next 3 minutes
407 case elapsed < 10*time.Minute:
408 return baseInterval * 8 // 4s for next 5 minutes
409 default:
410 return baseInterval * 16 // 8s after 10 minutes
411 }
412}
413
414type closeFunc func() error
415

Callers 2

AgentFunction · 0.85

Calls

no outgoing calls

Tested by 1