Skip to content

Commit

Permalink
apply coderabbit suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
window9u committed Dec 29, 2024
1 parent 8f8d142 commit 34fa918
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions pkg/webhook/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ var (
)

// WithExponentialBackoff retries the given webhookFn with exponential backoff.
func WithExponentialBackoff(ctx context.Context, maxRetries uint64, baseInterval, maxInterval gotime.Duration,
webhookFn func() (int, error)) error {
func WithExponentialBackoff(
ctx context.Context,
maxRetries uint64,
baseInterval,
maxInterval gotime.Duration,
webhookFn func() (int, error),
) error {
var retries uint64
var statusCode int
for retries <= maxRetries {
Expand Down
6 changes: 3 additions & 3 deletions server/backend/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (c *Config) ParseAuthWebhookCacheUnauthTTL() time.Duration {
func (c *Config) ParseProjectWebhookMaxWaitInterval() time.Duration {
result, err := time.ParseDuration(c.EventWebhookMaxWaitInterval)
if err != nil {
fmt.Fprintln(os.Stderr, "parse auth webhook max wait interval: %w", err)
fmt.Fprintln(os.Stderr, "parse project webhook max wait interval: %w", err)
os.Exit(1)
}

Expand All @@ -202,7 +202,7 @@ func (c *Config) ParseProjectWebhookMaxWaitInterval() time.Duration {
func (c *Config) ParseProjectWebhookBaseWaitInterval() time.Duration {
result, err := time.ParseDuration(c.EventWebhookBaseWaitInterval)
if err != nil {
fmt.Fprintln(os.Stderr, "parse auth webhook max wait interval: %w", err)
fmt.Fprintln(os.Stderr, "parse project webhook max wait interval: %w", err)
os.Exit(1)
}

Expand All @@ -213,7 +213,7 @@ func (c *Config) ParseProjectWebhookBaseWaitInterval() time.Duration {
func (c *Config) ParseProjectWebhookTimeout() time.Duration {
result, err := time.ParseDuration(c.EventWebhookRequestTimeout)
if err != nil {
fmt.Fprintln(os.Stderr, "parse auth webhook max wait interval: %w", err)
fmt.Fprintln(os.Stderr, "parse project webhook max wait interval: %w", err)
os.Exit(1)
}

Expand Down

0 comments on commit 34fa918

Please sign in to comment.