elasticsearch-transport 7.13.0 → 7.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7450e65878dd55088bede46fce476da9741626497de99f0b529c69ff31b244eb
4
- data.tar.gz: a53fc0c6ca93ec006f31adce15c69e199c58d4aa70dc0925ad979958eca2560e
3
+ metadata.gz: ae324619e058030508ffb4a2f69577c3ba49e7cb526afaf258c502739829cb33
4
+ data.tar.gz: 5e9ea4dd558023c2ae3153e69cda25a8de11d6bf559d7d38ed9f4a50f2218084
5
5
  SHA512:
6
- metadata.gz: e77be4dc4155782e358d20fc0eed4c6d164aad4e1c7fa93aec4a4e61b54bfb3674f1c363ffd6382b88423e455b1739fe0fd67fdf79024a60fc96e7f84296bf03
7
- data.tar.gz: 46efad58b4e8464ebc8fee9fe74bb1438c5f9bf32de8c3cfe70d96611b66e1b478582bd6dfea33d5868af1fdd5cb8b230bcb8f837970df362036f4a015a2f2b6
6
+ metadata.gz: c5960e2df76af2158c217847c794ffe2cf331feb9e531fc71d4ca9bbd5b79275c83bf3e6dacd7b9d4310f49ec7e146d246eea61c01df43048dbe418ef6ecf24c
7
+ data.tar.gz: 9325ff41a6cbb4f3a3bf1e3d5b1ffd6c8bcb6bb10b2724ae52a07f879cc5d6347efad13166bbcd08534887e91be6f63fc8d7d0449575e080679f435afa3008f0
@@ -78,16 +78,13 @@ module Elasticsearch
78
78
 
79
79
  # Returns a connection.
80
80
  #
81
- # If there are no alive connections, resurrects a connection with least failures.
81
+ # If there are no alive connections, returns a connection with least failures.
82
82
  # Delegates to selector's `#select` method to get the connection.
83
83
  #
84
84
  # @return [Connection]
85
85
  #
86
86
  def get_connection(options={})
87
- if connections.empty? && dead_connection = dead.sort { |a,b| a.failures <=> b.failures }.first
88
- dead_connection.alive!
89
- end
90
- selector.select(options)
87
+ selector.select(options) || @connections.min_by(&:failures)
91
88
  end
92
89
 
93
90
  def each(&block)
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module Transport
20
- VERSION = '7.13.0'.freeze
20
+ VERSION = '7.13.1'.freeze
21
21
  end
22
22
  end
@@ -249,6 +249,18 @@ describe Elasticsearch::Transport::Transport::Connections::Collection do
249
249
  collection.get_connection.host[:host]
250
250
  end).to eq((0..9).to_a)
251
251
  end
252
+
253
+ it 'always returns a connection' do
254
+ threads = 20.times.map do
255
+ Thread.new do
256
+ 20.times.map do
257
+ collection.get_connection.dead!
258
+ end
259
+ end
260
+ end
261
+
262
+ expect(threads.flat_map(&:value).size).to eq(400)
263
+ end
252
264
  end
253
265
  end
254
266
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.13.0
4
+ version: 7.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -429,7 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
429
  - !ruby/object:Gem::Version
430
430
  version: '0'
431
431
  requirements: []
432
- rubygems_version: 3.2.16
432
+ rubygems_version: 3.2.15
433
433
  signing_key:
434
434
  specification_version: 4
435
435
  summary: Ruby client for Elasticsearch.