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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae324619e058030508ffb4a2f69577c3ba49e7cb526afaf258c502739829cb33
|
4
|
+
data.tar.gz: 5e9ea4dd558023c2ae3153e69cda25a8de11d6bf559d7d38ed9f4a50f2218084
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
|
-
|
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)
|
@@ -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.
|
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-
|
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.
|
432
|
+
rubygems_version: 3.2.15
|
433
433
|
signing_key:
|
434
434
|
specification_version: 4
|
435
435
|
summary: Ruby client for Elasticsearch.
|