sidekiq-batch 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq/batch/version.rb +1 -1
- data/lib/sidekiq/batch.rb +8 -7
- 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: 56a9cb0fe2d48eba0959e20ad98e52e62e326bb71168f13f4c48e0ad33079447
|
4
|
+
data.tar.gz: ae145f7d0381f9a83ec2f0ba93be5a290589b1cd77e7544fc20b4f15fc823d0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45aee8ac26397847e5738ebf21b34a7505cd367d64596b9e72ff1c51993c622e53850999cb9bcae4fa2152c7e0471c65d3c824af3af06cdefecee199b4f7c8a5
|
7
|
+
data.tar.gz: 294c3bb0b9f908ee2aabf6dd62adcb296ff6409a148b3db77a456f50c728f369583bf15af4d2aa034947fb5175741985549c70d5328acb8ff471332689ad27c7
|
data/lib/sidekiq/batch.rb
CHANGED
@@ -203,12 +203,13 @@ module Sidekiq
|
|
203
203
|
end
|
204
204
|
|
205
205
|
def enqueue_callbacks(event, bid)
|
206
|
+
event_name = event.to_s
|
206
207
|
batch_key = "BID-#{bid}"
|
207
|
-
callback_key = "#{batch_key}-callbacks-#{
|
208
|
+
callback_key = "#{batch_key}-callbacks-#{event_name}"
|
208
209
|
already_processed, _, callbacks, queue, parent_bid, callback_batch = Sidekiq.redis do |r|
|
209
210
|
r.multi do |pipeline|
|
210
|
-
pipeline.hget(batch_key,
|
211
|
-
pipeline.hset(batch_key,
|
211
|
+
pipeline.hget(batch_key, event_name)
|
212
|
+
pipeline.hset(batch_key, event_name, true)
|
212
213
|
pipeline.smembers(callback_key)
|
213
214
|
pipeline.hget(batch_key, "callback_queue")
|
214
215
|
pipeline.hget(batch_key, "parent_bid")
|
@@ -222,10 +223,10 @@ module Sidekiq
|
|
222
223
|
parent_bid = !parent_bid || parent_bid.empty? ? nil : parent_bid # Basically parent_bid.blank?
|
223
224
|
callback_args = callbacks.reduce([]) do |memo, jcb|
|
224
225
|
cb = Sidekiq.load_json(jcb)
|
225
|
-
memo << [cb['callback'],
|
226
|
+
memo << [cb['callback'], event_name, cb['opts'], bid, parent_bid]
|
226
227
|
end
|
227
228
|
|
228
|
-
opts = {"bid" => bid, "event" =>
|
229
|
+
opts = {"bid" => bid, "event" => event_name}
|
229
230
|
|
230
231
|
# Run callback batch finalize synchronously
|
231
232
|
if callback_batch
|
@@ -233,7 +234,7 @@ module Sidekiq
|
|
233
234
|
# Pass in stored event as callback finalize is processed on complete event
|
234
235
|
cb_opts = callback_args.first&.at(2) || opts
|
235
236
|
|
236
|
-
Sidekiq.logger.debug {"Run callback batch bid: #{bid} event: #{
|
237
|
+
Sidekiq.logger.debug {"Run callback batch bid: #{bid} event: #{event_name} args: #{callback_args.inspect}"}
|
237
238
|
# Finalize now
|
238
239
|
finalizer = Sidekiq::Batch::Callback::Finalize.new
|
239
240
|
status = Status.new bid
|
@@ -242,7 +243,7 @@ module Sidekiq
|
|
242
243
|
return
|
243
244
|
end
|
244
245
|
|
245
|
-
Sidekiq.logger.debug {"Enqueue callback bid: #{bid} event: #{
|
246
|
+
Sidekiq.logger.debug {"Enqueue callback bid: #{bid} event: #{event_name} args: #{callback_args.inspect}"}
|
246
247
|
|
247
248
|
if callback_args.empty?
|
248
249
|
# Finalize now
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Naglik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|