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

Add exponential backoff #134

Merged
merged 3 commits into from
Dec 5, 2017

Conversation

rohitpaulk
Copy link
Collaborator

This PR adds exponential backoff when requests are retried.

I picked the default backoff parameter values from https://github.com/segmentio/analytics-go and https://github.com/segmentio/backo-go.

@codecov-io
Copy link

codecov-io commented Dec 5, 2017

Codecov Report

Merging #134 into master will decrease coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #134      +/-   ##
==========================================
- Coverage   98.85%   98.74%   -0.11%     
==========================================
  Files          12       14       +2     
  Lines         612      799     +187     
==========================================
+ Hits          605      789     +184     
- Misses          7       10       +3
Impacted Files Coverage Δ
lib/segment/analytics/request.rb 100% <100%> (ø) ⬆️
lib/segment/analytics/defaults.rb 100% <100%> (ø) ⬆️
lib/segment/analytics/backoff_policy.rb 100% <100%> (ø)
spec/segment/analytics/request_spec.rb 100% <100%> (ø) ⬆️
spec/segment/analytics/client_spec.rb 98.1% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3281176...0c6ccdd. Read the comment docs.

@@ -6,15 +6,22 @@ module Request
PORT = 443
PATH = '/v1/import'
SSL = true
HEADERS = { :accept => 'application/json' }
Copy link
Contributor

Choose a reason for hiding this comment

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

was this previously unused?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. It was being assigned to a variable, but the actual headers used were hardcoded.

(The diff for this individual commit includes all the relevant files).

@f2prateek f2prateek merged commit 8cb8e9d into segmentio:master Dec 5, 2017
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