elasticsearch_scanner 0.1.0 → 0.1.2

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: 0c430016b9eba6aecdffecc2da894a83735979d58c74f0a0f6f1142de91db67f
4
- data.tar.gz: 4d0279810b2b5306524101d7dbd5ee70c2ce63f7ddda5b155019b60d9bd3ded3
3
+ metadata.gz: 2bb608be40ca3681cdab9f457f157eef0c0a1e84271ced6a56246425f651a4b2
4
+ data.tar.gz: dd0390e0fbe9ca0a44f12c45140590be3204bc11bc31aceffc03529248fa0a3f
5
5
  SHA512:
6
- metadata.gz: 7eb2d0443e03e24ff1d9021ee6e1883069e6281e57a22416b427fa9efc75b7c3ecb443112da319d82b11c44d10a86b1307dc9cdb423512e66c7542ea510709f6
7
- data.tar.gz: 015d278b62b07893b32383d8b6d3b286ac6e968ca203b01c920588c8832d9a5127eecda4ef5461d9de62d987c46dee55a2186467424840500bb6cf9464cca530
6
+ metadata.gz: 27259fcf1dd1871a13b54b93e4b4f2fbae6755f93569d5085bd1460b48f4e42711c290882c16ef9d9399e3cbf70ede8f61ae1b41833d104e69f9b6e96a72365d
7
+ data.tar.gz: de0c6f9087181f1337a28cbf58b06503ad1a3062737b91e602552e815cbc02ae591021f77ff191a02af6362fdb14548ec09a2b29a516cc98e741966d272b0d20
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elasticsearch_scanner'
5
- s.version = '0.1.0'
5
+ s.version = '0.1.2'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'ElasticSearch index scanner'
8
8
  s.description = 'Iterates over the entire index'
@@ -8,11 +8,12 @@ class ElasticSearchScanner
8
8
  attr_reader :total_request_time,
9
9
  :total_elasticsearch_time
10
10
 
11
- def initialize(url, query, size=100, scroll_ttl='1m')
11
+ def initialize(url, query, size=100, scroll_ttl = '1m', max_retries = 5)
12
12
  @url = url
13
13
  @query = query
14
14
  @size = size
15
15
  @scroll_ttl = scroll_ttl
16
+ @max_retries = max_retries
16
17
  @fields_to_return = true # all fields
17
18
  @has_more = true
18
19
  @total_request_time = 0.0
@@ -85,5 +86,13 @@ class ElasticSearchScanner
85
86
  @scroll_id = data['_scroll_id']
86
87
  @has_more = data['hits']['hits'].size == @size
87
88
  data['hits']['hits']
89
+ rescue Net::ReadTimeout => e
90
+ attempts ||= 0
91
+ attempts += 1
92
+ if attempts < @max_retries
93
+ sleep([0.1, 0.2, 0.4, 1.0][attempts-1] || 1.0)
94
+ retry
95
+ end
96
+ raise e
88
97
  end
89
98
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch