process-compose icon indicating copy to clipboard operation
process-compose copied to clipboard

Backoff policy is constant, not exponential

Open 9999years opened this issue 9 months ago • 0 comments

The current backoff implementation in process-compose uses a (user-customizable) constant-time backoff with a minimum polling interval of 1 second.

However, users customizing a polling interval generally expect some form of exponential backoff in order to poll more frequently at the beginning of a process (when changes are more likely) and then less frequently as time goes on.

Go seems to have a decent backoff package by @cenkalti which exposes the following interface:

type ExponentialBackOff struct {
	InitialInterval     time.Duration
	RandomizationFactor float64
	Multiplier          float64
	MaxInterval         time.Duration
	// After MaxElapsedTime the ExponentialBackOff returns Stop.
	// It never stops if MaxElapsedTime == 0.
	MaxElapsedTime time.Duration
	Stop           time.Duration
	Clock          Clock
	// contains filtered or unexported fields
}

9999years avatar Apr 03 '25 20:04 9999years