Skip to content

Commit

Permalink
Retryer configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
def committed Jun 16, 2023
1 parent f0134c9 commit ede5e98
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/coroot/coroot-aws-agent/elasticache"
"github.com/coroot/coroot-aws-agent/flags"
Expand All @@ -12,6 +13,7 @@ import (
"gopkg.in/alecthomas/kingpin.v2"
"net/http"
_ "net/http/pprof"
"time"
)

var version = "unknown"
Expand All @@ -24,6 +26,13 @@ func main() {
log := logger.NewKlog("")

cfg := aws.NewConfig().WithRegion(*flags.AwsRegion)
cfg.Retryer = client.DefaultRetryer{
NumMaxRetries: 5,
MinRetryDelay: 500 * time.Millisecond,
MaxRetryDelay: 10 * time.Second,
MinThrottleDelay: 500 * time.Millisecond,
MaxThrottleDelay: 10 * time.Second,
}
awsSession, err := session.NewSession(cfg)
if err != nil {
log.Error(err)
Expand Down

0 comments on commit ede5e98

Please sign in to comment.