Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back off when writing to Dynamo and S3 #2723

Merged
merged 3 commits into from
Jul 20, 2017
Merged

Conversation

2opremio
Copy link
Contributor

Fixes #2345

I am intentionally not backing off when writing to Memcached nor NATS. The first one is an optimization and the second one is just used for shortcut reports (not essential).

I tried to use https://github.com/weaveworks/common/blob/master/backoff/backoff.go but it's not suitable for this usecase (it doesn't forward errors and doesn't accept retry limits).

@2opremio 2opremio requested a review from ekimekim July 18, 2017 15:36
Copy link
Contributor

@ekimekim ekimekim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. nice trick with using a closure to circumvent the need to return a generic value from withBackoff.

time.Sleep(backoff)
err = f()
retries += 1
backoff *= 2

This comment was marked as abuse.

ReturnConsumedCapacity: aws.String(dynamodb.ReturnConsumedCapacityTotal),
ReturnConsumedCapacity: aws.String(dynamodb.ReturnConsumedCapacityTotal),
})
return err

This comment was marked as abuse.

var reportSize int
err = withBackoff(func() error {
var err error
reportSize, err = c.s3.StoreReportBytes(ctx, reportKey, buf)

This comment was marked as abuse.

@2opremio 2opremio merged commit a4320ad into master Jul 20, 2017
@2opremio 2opremio deleted the 2345-backoff-on-dynamo-and-s3 branch July 20, 2017 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants