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 5
5
6
6
module InfluxDB
7
7
# rubocop:disable Metrics/MethodLength
8
+ # rubocop:disable Metrics/ModuleLength
8
9
# rubocop:disable Metrics/AbcSize
9
10
module HTTP # :nodoc:
10
11
def get ( url , options = { } )
@@ -43,7 +44,7 @@ def connect_with_retry
43
44
delay = config . initial_delay
44
45
retry_count = 0
45
46
46
- http = get_http
47
+ http = current_http
47
48
48
49
begin
49
50
http . start unless http . started?
@@ -135,14 +136,14 @@ def generate_cert_store
135
136
store
136
137
end
137
138
138
- def get_http
139
+ def current_http
139
140
return build_http config . next_host unless config . persistent
140
141
141
142
@https ||=
142
143
begin
143
- https = config . hosts . map { |host |
144
+ https = config . hosts . map do |host |
144
145
build_http host
145
- }
146
+ end
146
147
147
148
Hash [ config . hosts . zip ( https ) ]
148
149
end
@@ -171,5 +172,6 @@ def build_http(host)
171
172
end
172
173
end
173
174
# rubocop:enable Metrics/MethodLength
175
+ # rubocop:enable Metrics/ModuleLength
174
176
# rubocop:enable Metrics/AbcSize
175
177
end
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ module InfluxDB
45
45
denormalize : true ,
46
46
} . freeze
47
47
48
+ # rubocop:disable Metrics/ClassLength
49
+
48
50
# InfluxDB client configuration
49
51
class Config
50
52
# Valid values for the "auth_method" option.
@@ -205,4 +207,5 @@ def coerce(name, value)
205
207
end
206
208
end
207
209
end
210
+ # rubocop:enable Metrics/ClassLength
208
211
end
Original file line number Diff line number Diff line change 60
60
end
61
61
end
62
62
63
- describe "#get_http " do
63
+ describe "#current_http " do
64
64
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
67
67
68
68
expect ( first ) . to equal ( second )
69
69
end
70
70
71
71
it "returns a new connection with persistence disabled" do
72
72
subject . config . persistent = false
73
73
74
- first = subject . send :get_http
75
- second = subject . send :get_http
74
+ first = subject . send :current_http
75
+ second = subject . send :current_http
76
76
77
77
expect ( first ) . to_not equal ( second )
78
78
end
You can’t perform that action at this time.
0 commit comments