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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d45a854229157eb70e9fb9b04390e6b4958fd535cb68d6dd2e0aab84c51e4b7
4
- data.tar.gz: b8ec67ac9cce0cafde5b70883c0a77794f0d8506b694f74fb79765dc0ae5d7f2
3
+ metadata.gz: 56a9cb0fe2d48eba0959e20ad98e52e62e326bb71168f13f4c48e0ad33079447
4
+ data.tar.gz: ae145f7d0381f9a83ec2f0ba93be5a290589b1cd77e7544fc20b4f15fc823d0e
5
5
  SHA512:
6
- metadata.gz: e703eb7d37c4234269835ee009d73cafd4bb9afb11d8c818860e18e7504244db08142830eeac20d32bff96079febcb13ae130fd7e0a21eadeea6115cb5384989
7
- data.tar.gz: e616deb4ed0f7599b9c09d1d0fd943f25131c89966ae0575b073c507053ac9012357ed07ac34456ba0f60d1a91ab7d75c337ffe6fb4e8aca6b21fe2aea2b1ea4
6
+ metadata.gz: 45aee8ac26397847e5738ebf21b34a7505cd367d64596b9e72ff1c51993c622e53850999cb9bcae4fa2152c7e0471c65d3c824af3af06cdefecee199b4f7c8a5
7
+ data.tar.gz: 294c3bb0b9f908ee2aabf6dd62adcb296ff6409a148b3db77a456f50c728f369583bf15af4d2aa034947fb5175741985549c70d5328acb8ff471332689ad27c7
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  class Batch
3
- VERSION = '0.1.7'.freeze
3
+ VERSION = '0.1.8'.freeze
4
4
  end
5
5
  end
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-#{event}"
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, event)
211
- pipeline.hset(batch_key, event, true)
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'], event, cb['opts'], bid, parent_bid]
226
+ memo << [cb['callback'], event_name, cb['opts'], bid, parent_bid]
226
227
  end
227
228
 
228
- opts = {"bid" => bid, "event" => 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: #{event} args: #{callback_args.inspect}"}
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: #{event} args: #{callback_args.inspect}"}
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.7
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-13 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq