diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4b7cee6 --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module github.com/gogama/incite + +go 1.13 + +require ( + github.com/aws/aws-sdk-go v1.21.6 + github.com/stretchr/testify v1.7.0 + golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..9427324 --- /dev/null +++ b/go.sum @@ -0,0 +1,24 @@ +github.com/aws/aws-sdk-go v1.21.6 h1:3GuIm55Uls52aQIDGBnSEZbk073jpasfQyeM5eZU61Q= +github.com/aws/aws-sdk-go v1.21.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/incite.go b/incite.go index 5064419..066bb90 100644 --- a/incite.go +++ b/incite.go @@ -554,22 +554,17 @@ func (m *mgr) startNextChunk() error { // Assert: Lock is acquired. } func isTemporary(err error) bool { - switch x := err.(type) { - case *cloudwatchlogs.DataAlreadyAcceptedException, *cloudwatchlogs.InvalidOperationException, - *cloudwatchlogs.InvalidParameterException, *cloudwatchlogs.InvalidSequenceTokenException, - *cloudwatchlogs.MalformedQueryException, *cloudwatchlogs.OperationAbortedException, - *cloudwatchlogs.ResourceAlreadyExistsException, *cloudwatchlogs.ResourceNotFoundException, - *cloudwatchlogs.UnrecognizedClientException: - return false - case *cloudwatchlogs.LimitExceededException, *cloudwatchlogs.ServiceUnavailableException: - return true - case awserr.RequestFailure: - // Omit 'e' suffix on 'throttl' to match Throttled and Throttling. - return strings.Contains(strings.ToLower(x.Code()), "throttl") || - strings.Contains(strings.ToLower(x.Message()), "rate exceeded") - default: - return false + if x, ok := err.(awserr.RequestFailure); ok { + switch x.Code() { + case cloudwatchlogs.ErrCodeLimitExceededException, cloudwatchlogs.ErrCodeServiceUnavailableException: + return true + default: + // Omit 'e' suffix on 'throttl' to match Throttled and Throttling. + return strings.Contains(strings.ToLower(x.Code()), "throttl") || + strings.Contains(strings.ToLower(x.Message()), "rate exceeded") + } } + return false } func (m *mgr) pollNextChunk() int {