sqrewdriver 0.1.0 → 0.1.1
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 +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/sqrewdriver/client.rb +14 -6
- data/lib/sqrewdriver/errors.rb +2 -0
- data/lib/sqrewdriver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 502c4b11e87ca48df0966e2638a89dcb7295efa9399e4953e039345165e550b3
|
4
|
+
data.tar.gz: 6522640879f24a8422dc4e50fe778333bdd0a9d1c74f815932c5446b67cb96f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c67020f0209e9045497c93e7e023c03df693e55c0a7a40a1785e42e294ae1a025631cbd0981d4ec64a03fd1fb6341bdd676ae0d2a9927b15afcfe1e946a6174
|
7
|
+
data.tar.gz: 866c67be25a34ae3a39fb76971bdf4f2e15f313a13a3535e50f05ef682f11d488b94c9d95180fb7dd4bd95ab6f031c35056a1aa27a022a9bf2f21b602fc4316b
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/sqrewdriver/client.rb
CHANGED
@@ -55,6 +55,10 @@ module Sqrewdriver
|
|
55
55
|
@data << message
|
56
56
|
@bytesize += size
|
57
57
|
end
|
58
|
+
|
59
|
+
def size
|
60
|
+
@data.size
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
include MonitorMixin
|
@@ -77,7 +81,7 @@ module Sqrewdriver
|
|
77
81
|
|
78
82
|
synchronize do
|
79
83
|
@chunks << Chunk.new if @chunks.empty?
|
80
|
-
if @chunks.last.bytesize + add_size > MAX_PAYLOAD_SIZE
|
84
|
+
if @chunks.last.size == MAX_BATCH_SIZE || @chunks.last.bytesize + add_size > MAX_PAYLOAD_SIZE
|
81
85
|
new_chunk = Chunk.new
|
82
86
|
new_chunk.add(message, add_size)
|
83
87
|
@chunks << new_chunk
|
@@ -97,7 +101,7 @@ module Sqrewdriver
|
|
97
101
|
|
98
102
|
synchronize do
|
99
103
|
@chunks << Chunk.new if @chunks.empty?
|
100
|
-
if @chunks.last.bytesize + add_size > MAX_PAYLOAD_SIZE
|
104
|
+
if @chunks.last.size == MAX_BATCH_SIZE || @chunks.last.bytesize + add_size > MAX_PAYLOAD_SIZE
|
101
105
|
new_chunk = Chunk.new
|
102
106
|
new_chunk.add(base_message, add_size)
|
103
107
|
@chunks << new_chunk
|
@@ -171,13 +175,17 @@ module Sqrewdriver
|
|
171
175
|
|
172
176
|
def wait_flushing(timeout = nil)
|
173
177
|
zipped = Concurrent::Promises.zip_futures_on(@thread_pool, *@waiting_futures)
|
174
|
-
|
178
|
+
unless zipped.wait(timeout)
|
179
|
+
raise Sqrewdriver::SendMessageTimeout
|
180
|
+
end
|
181
|
+
|
182
|
+
exceptions = zipped.reason
|
175
183
|
raise Sqrewdriver::SendMessageErrors.new(exceptions) if exceptions
|
176
184
|
end
|
177
185
|
|
178
|
-
def flush
|
186
|
+
def flush(timeout = nil)
|
179
187
|
flush_async
|
180
|
-
wait_flushing
|
188
|
+
wait_flushing(timeout)
|
181
189
|
end
|
182
190
|
|
183
191
|
private
|
@@ -201,7 +209,7 @@ module Sqrewdriver
|
|
201
209
|
def ensure_serializer_for_aggregation!(serializer)
|
202
210
|
valid_serializer = @aggregate_messages_per.nil? || serializer.is_a?(Sqrewdriver::Serdes::JSONSerde)
|
203
211
|
unless valid_serializer
|
204
|
-
raise InvalidSerializer, "If you use `aggregate_messages_per`, serializer must be `
|
212
|
+
raise InvalidSerializer, "If you use `aggregate_messages_per`, serializer must be `Sqrewdriver::Serdes::JSONSerde`"
|
205
213
|
end
|
206
214
|
end
|
207
215
|
end
|
data/lib/sqrewdriver/errors.rb
CHANGED
data/lib/sqrewdriver/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqrewdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joker1007
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sqs
|