File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 55
66module InfluxDB
77 # rubocop:disable Metrics/MethodLength
8+ # rubocop:disable Metrics/ModuleLength
89 # rubocop:disable Metrics/AbcSize
910 module HTTP # :nodoc:
1011 def get ( url , options = { } )
@@ -43,7 +44,7 @@ def connect_with_retry
4344 delay = config . initial_delay
4445 retry_count = 0
4546
46- http = get_http
47+ http = current_http
4748
4849 begin
4950 http . start unless http . started?
@@ -135,14 +136,14 @@ def generate_cert_store
135136 store
136137 end
137138
138- def get_http
139+ def current_http
139140 return build_http config . next_host unless config . persistent
140141
141142 @https ||=
142143 begin
143- https = config . hosts . map { |host |
144+ https = config . hosts . map do |host |
144145 build_http host
145- }
146+ end
146147
147148 Hash [ config . hosts . zip ( https ) ]
148149 end
@@ -171,5 +172,6 @@ def build_http(host)
171172 end
172173 end
173174 # rubocop:enable Metrics/MethodLength
175+ # rubocop:enable Metrics/ModuleLength
174176 # rubocop:enable Metrics/AbcSize
175177end
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ module InfluxDB
4545 denormalize : true ,
4646 } . freeze
4747
48+ # rubocop:disable Metrics/ClassLength
49+
4850 # InfluxDB client configuration
4951 class Config
5052 # Valid values for the "auth_method" option.
@@ -205,4 +207,5 @@ def coerce(name, value)
205207 end
206208 end
207209 end
210+ # rubocop:enable Metrics/ClassLength
208211end
Original file line number Diff line number Diff line change 6060 end
6161 end
6262
63- describe "#get_http " do
63+ describe "#current_http " do
6464 it "returns an existing connection with persistence enabled" do
65- first = subject . send :get_http
66- second = subject . send :get_http
65+ first = subject . send :current_http
66+ second = subject . send :current_http
6767
6868 expect ( first ) . to equal ( second )
6969 end
7070
7171 it "returns a new connection with persistence disabled" do
7272 subject . config . persistent = false
7373
74- first = subject . send :get_http
75- second = subject . send :get_http
74+ first = subject . send :current_http
75+ second = subject . send :current_http
7676
7777 expect ( first ) . to_not equal ( second )
7878 end
You can’t perform that action at this time.
0 commit comments