File tree Expand file tree Collapse file tree 5 files changed +23
-0
lines changed Expand file tree Collapse file tree 5 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -770,6 +770,7 @@ found in `lib/influxdb/config.rb` for the source of truth.
770770| | ` :open_timeout ` | 5 | socket timeout
771771| | ` :read_timeout ` | 300 | socket timeout
772772| | ` :auth_method ` | "params" | "params", "basic_auth" or "none"
773+ | | ` :persistent ` | true | set to false to disable persistent connections
773774| Retry | ` :retry ` | -1 | max. number of retry attempts (reading and writing)
774775| | ` :initial_delay ` | 0.01 | initial wait time (doubles every retry attempt)
775776| | ` :max_delay ` | 30 | max. wait time when retrying
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ def generate_cert_store
136136 end
137137
138138 def get_http
139+ return build_http config . next_host unless config . persistent
140+
139141 @https ||=
140142 begin
141143 https = config . hosts . map { |host |
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ module InfluxDB
1818 auth_method : nil ,
1919 proxy_addr : nil ,
2020 proxy_port : nil ,
21+ persistent : true ,
2122
2223 # SSL options
2324 use_ssl : false ,
Original file line number Diff line number Diff line change 6060 end
6161 end
6262
63+ describe "#get_http" do
64+ it "returns an existing connection with persistence enabled" do
65+ first = subject . send :get_http
66+ second = subject . send :get_http
67+
68+ expect ( first ) . to equal ( second )
69+ end
70+
71+ it "returns a new connection with persistence disabled" do
72+ subject . config . persistent = false
73+
74+ first = subject . send :get_http
75+ second = subject . send :get_http
76+
77+ expect ( first ) . to_not equal ( second )
78+ end
79+ end
80+
6381 describe "GET #ping" do
6482 it "returns OK" do
6583 stub_request ( :get , "http://influxdb.test:9999/ping" )
Original file line number Diff line number Diff line change 1414 specify { expect ( conf . port ) . to eq 8086 }
1515 specify { expect ( conf . username ) . to eq "root" }
1616 specify { expect ( conf . password ) . to eq "root" }
17+ specify { expect ( conf . persistent ) . to be_truthy }
1718 specify { expect ( conf . use_ssl ) . to be_falsey }
1819 specify { expect ( conf . time_precision ) . to eq "s" }
1920 specify { expect ( conf . auth_method ) . to eq "params" }
You can’t perform that action at this time.
0 commit comments