mirror of
https://github.com/hanzo-fi/webhooks.git
synced 2026-10-30 20:32:55 +00:00
26 lines
513 B
Go
26 lines
513 B
Go
package backoff
|
|
|
|
import (
|
|
"time"
|
|
|
|
webhooks "github.com/hanzo-fi/webhooks/pkg"
|
|
)
|
|
|
|
func NewNoRetry() webhooks.BackoffPolicy {
|
|
return new(NoRetry)
|
|
}
|
|
|
|
type NoRetry struct{}
|
|
|
|
func (n *NoRetry) GetRetryDelay(attemptNumber int) (time.Duration, error) {
|
|
return 0, ErrMaxAttemptsReached
|
|
}
|
|
|
|
func (n *NoRetry) CanRetryAttempt(attemptNumber int) error {
|
|
return ErrMaxAttemptsReached
|
|
}
|
|
|
|
func (n *NoRetry) LimitRetryDelay(attemptNumber int, delay time.Duration) (time.Duration, error) {
|
|
return 0, ErrMaxAttemptsReached
|
|
}
|