-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* caching and retries * fix unit tests * logging * fixes * remove caching * avoid reconciling all spot events * fixes * make spot lookback configurable * Update main.go * bump version
- Loading branch information
1 parent
63e0767
commit 71e192f
Showing
13 changed files
with
177 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package aws | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/aws/aws-sdk-go/aws/client" | ||
"github.com/aws/aws-sdk-go/aws/request" | ||
) | ||
|
||
type RetryLogger struct { | ||
client.DefaultRetryer | ||
} | ||
|
||
var _ request.Retryer = &RetryLogger{} | ||
|
||
var DefaultRetryer = client.DefaultRetryer{ | ||
NumMaxRetries: 50, | ||
MinThrottleDelay: time.Second * 5, | ||
MaxThrottleDelay: time.Second * 60, | ||
MinRetryDelay: time.Second * 1, | ||
MaxRetryDelay: time.Second * 5, | ||
} | ||
|
||
func NewRetryLogger(retryer client.DefaultRetryer) *RetryLogger { | ||
return &RetryLogger{ | ||
retryer, | ||
} | ||
} | ||
|
||
func (l RetryLogger) RetryRules(r *request.Request) time.Duration { | ||
var ( | ||
duration = l.DefaultRetryer.RetryRules(r) | ||
service = r.ClientInfo.ServiceName | ||
name string | ||
err string | ||
) | ||
|
||
if r.Operation != nil { | ||
name = r.Operation.Name | ||
} | ||
method := fmt.Sprintf("%v/%v", service, name) | ||
|
||
if r.Error != nil { | ||
err = fmt.Sprintf("%v", r.Error) | ||
} else { | ||
err = fmt.Sprintf("%d %s", r.HTTPResponse.StatusCode, r.HTTPResponse.Status) | ||
} | ||
log.V(1).Info("retryable failure", "error", err, "method", method, "backoff", duration) | ||
|
||
return duration | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.