Skip to content

Commit

Permalink
Add faraday-net_http_persistent gem and update Faraday configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Nov 11, 2024
1 parent 7c298d0 commit ed1f7f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ gem "faraday-retry"
gem "faraday-gzip"
gem "faraday-follow_redirects"
gem "faraday-multipart"
gem 'faraday-net_http_persistent'
gem "nokogiri"
gem "oj"
gem "redis"
Expand Down
12 changes: 9 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ GEM
multipart-post (~> 2)
faraday-net_http (3.3.0)
net-http
faraday-net_http_persistent (2.3.0)
faraday (~> 2.5)
net-http-persistent (>= 4.0.4, < 5)
faraday-retry (2.2.1)
faraday (~> 2.0)
ffi (1.17.0)
Expand Down Expand Up @@ -206,7 +209,9 @@ GEM
multipart-post (2.4.1)
net-http (0.5.0)
uri
net-imap (0.5.0)
net-http-persistent (4.0.4)
connection_pool (~> 2.2)
net-imap (0.5.1)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -235,7 +240,7 @@ GEM
ostruct (>= 0.2)
ostruct (0.6.1)
packageurl-ruby (0.1.0)
pagy (9.2.0)
pagy (9.2.2)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
Expand Down Expand Up @@ -332,7 +337,7 @@ GEM
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
securerandom (0.3.1)
securerandom (0.3.2)
semantic (1.6.1)
semantic_range (3.1.0)
shoulda-context (2.0.0)
Expand Down Expand Up @@ -402,6 +407,7 @@ DEPENDENCIES
faraday-follow_redirects
faraday-gzip
faraday-multipart
faraday-net_http_persistent
faraday-retry
gitlab
google-protobuf
Expand Down
3 changes: 2 additions & 1 deletion config/initializers/faraday.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# require 'faraday/typhoeus'
# Faraday.default_adapter = :typhoeus
Faraday.default_adapter = :net_http_persistent

Octokit.middleware = Faraday::RackBuilder.new do |builder|
builder.use Octokit::Middleware::FollowRedirects
builder.use Octokit::Response::RaiseError
builder.request :instrumentation
builder.request :retry
builder.request :retry, max: 5, interval: 0.05, backoff_factor: 2, exceptions: [Faraday::ConnectionFailed, Faraday::TimeoutError]
builder.adapter Faraday.default_adapter, accept_encoding: "gzip"
end

0 comments on commit ed1f7f4

Please sign in to comment.