Skip to content

Commit

Permalink
Merge pull request #8 from bitrise-io/RA-2310-add-retry-to-apple-clie…
Browse files Browse the repository at this point in the history
…nt-calls

[RA-2310] Add faraday retry
  • Loading branch information
gaborpongracz committed Jan 15, 2024
2 parents 44d4901 + a8f3337 commit b3295b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/pkg/
/spec/reports/
/tmp/

/.idea
# rspec failure tracking
.rspec_status
.ruby-version
Expand Down
1 change: 1 addition & 0 deletions app_store_connect_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "faraday"
spec.add_dependency "faraday-retry"
spec.add_dependency "jwt"

spec.add_development_dependency "rake"
Expand Down
1 change: 1 addition & 0 deletions lib/app_store_connect_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'openssl'
require 'jwt'
require 'faraday'
require 'faraday/retry'
require_relative "app_store_connect_api/client"
require_relative "app_store_connect_api/version"

Expand Down
7 changes: 6 additions & 1 deletion lib/app_store_connect_api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ def connection
@connection ||= Faraday.new(url: APP_STORE_CONNECT_API_ROOT_URL,
request: { timeout: @request_timeout },
headers: { 'Authorization' => "Bearer #{@authorization.token}" }) do |f|

f.request :retry,
max: 3,
interval: 1,
interval_randomness: 0.2,
backoff_factor: 1.5
f.request :json
f.response :json, content_type: /\bjson$/
f.adapter :net_http
end
end
end
Expand Down

0 comments on commit b3295b7

Please sign in to comment.