Skip to content

Commit 485510b

Browse files
binarycodeioquatix
authored andcommitted
move the faraday close method detection back to constant
1 parent 0905976 commit 485510b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/async/http/faraday/adapter.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525
module Async
2626
module HTTP
2727
module Faraday
28+
# Detect whether we can use persistent connections:
29+
PERSISTENT = ::Faraday::Connection.instance_methods.include?(:close)
30+
2831
class Adapter < ::Faraday::Adapter
2932
def initialize(*arguments, **options, &block)
3033
super
3134

3235
@internet = Async::HTTP::Internet.new
33-
@persistent = ::Faraday::Connection.instance_methods.include?(:close) && options.fetch(:persistent, true)
36+
@persistent = PERSISTENT && options.fetch(:persistent, true)
3437
end
3538

3639
def close

0 commit comments

Comments
 (0)