esse 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5aa2b7107d8bc92810414bacbca1c821024e8771b50be5f5c0afb4b66349874
4
- data.tar.gz: 7ea6f01e96dc3e7a260f4b2cc8198f88231920dbd3e96a1d2493df34eb1bfeaa
3
+ metadata.gz: fd1807aa9b2b2c92564d5e35d5a62282c67b9d25883fdc6166ca8981ee9008ac
4
+ data.tar.gz: 1cf17acb25d5b6bcf88e0999fc29c90a564b55d31ac51dce148f397c17ced4c4
5
5
  SHA512:
6
- metadata.gz: bce16d5dd68a36e0f75215994a96746982d84529fddd0f667660ca644cf8ca3c89c79211db91499161323c025528a48e2b371bddf743a4e19de4a95988121196
7
- data.tar.gz: e87a03b8fc0c10fcbbfb7945483c740af2958a2991a1ea5330503f41ca8390988110dbddce59a62cb61987cf020b9f24bb4a02c3770d5dc2bed56bf124163226
6
+ metadata.gz: bd72ab5edf509428c62ea598305a8351105c0073fa63a2246eb9eecb84b99fa2115355b1c7f881afdd500196a0d31482a7be7ebb8f4b92743eca3a8bd775840c
7
+ data.tar.gz: 94f0e1fed7ccaac67b8795a349ef51ab0cbfa9251fc219ffa49510a25a7e3ea52e44ae3ec386a7437014a5314ae65a0a20bfca542babddbb124a3381e49fd1c0
@@ -61,8 +61,10 @@ module Esse
61
61
 
62
62
  raise e unless last_retry_per_document
63
63
  requests = requests_per_document
64
+ ids = document_ids
65
+ id_info = ids.any? ? " (document IDs: #{ids.join(', ')})" : ''
64
66
  Esse.logger.warn <<~MSG
65
- Request entity too large after balancing, retrying one document per request as a last resort.
67
+ Request entity too large after balancing, retrying one document per request as a last resort#{id_info}.
66
68
  If a single document still exceeds the bulk size, the error will be raised.
67
69
  MSG
68
70
  retry
@@ -92,9 +94,11 @@ module Esse
92
94
 
93
95
  def requests_in_small_chunks(chunk_size: 1)
94
96
  arr = build_per_document_requests(chunk_size: chunk_size)
97
+ ids = document_ids
98
+ id_info = ids.any? ? " (document IDs: #{ids.join(', ')})" : ''
95
99
  Esse.logger.warn <<~MSG
96
- Retrying the last request in small chunks of #{chunk_size} documents.
97
- This is a last resort to avoid timeout errors, consider increasing the bulk size or reducing the batch size.
100
+ Timeout error, retrying one document per request as a last resort#{id_info}.
101
+ Consider increasing the bulk size or reducing the batch size.
98
102
  MSG
99
103
  arr
100
104
  end
@@ -103,6 +107,10 @@ module Esse
103
107
  build_per_document_requests(chunk_size: 1)
104
108
  end
105
109
 
110
+ def document_ids
111
+ (@create + @index + @update + @delete).filter_map { |op| op.values.first[:_id] }
112
+ end
113
+
106
114
  def build_per_document_requests(chunk_size: 1)
107
115
  arr = []
108
116
  @create.each_slice(chunk_size) { |slice| arr << Import::RequestBodyAsJson.new.tap { |r| r.create = slice } }
data/lib/esse/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Esse
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos G. Zimmermann