kinesis-consumer/store/ddb/retryer.go
Harlow Ward c72f561abd
Replace Checkpoint with Store interface (#90)
As we work towards introducing consumer groups to the repository we need a more generic name for the persistence layer for storing checkpoints and leases for given shards. 

* Rename `checkpoint` to `store`
2019-07-28 21:18:40 -07:00

24 lines
506 B
Go

package ddb
import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/dynamodb"
)
// Retryer interface contains one method that decides whether to retry based on error
type Retryer interface {
ShouldRetry(error) bool
}
type DefaultRetryer struct {
Retryer
}
func (r *DefaultRetryer) ShouldRetry(err error) bool {
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == dynamodb.ErrCodeProvisionedThroughputExceededException {
return true
}
}
return false
}