rabbitek 0.4.1 → 0.6.0

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: 19938345d3105a6f1fc72afaab8a04c1df84d6a528b8af255c9173facc119329
4
- data.tar.gz: 579f14f003bc200d073d0a2ceec1f6c44483939e3ec82905cfb98f4cd49c7c16
3
+ metadata.gz: 88da1d0bb088947a715798f972002cef412c4f655c806934f12aba6aed018701
4
+ data.tar.gz: 898fda5b61e8fa03ff97408323ebdd1170ebcbcd727e65ba8bfd34acab411d02
5
5
  SHA512:
6
- metadata.gz: 18a5fd3d4bf1f947b0fe8935c48a7dfa37d831fa4eea9396caa935ebb63ec9b04c05d518a28ebf68f11e3b34f76cb4b55a0c58886b465d12ab2c911ce5f9b45b
7
- data.tar.gz: 6e8ffe529da3cb2a1fdccd75f5d2de6ef0b3bee54de8b38854f09e659f5c91a160bfce09f89240b7d46e3c997e6c35446c9f5129481e755af08c5c7126273801
6
+ metadata.gz: 4bcc83ff5c083038d11b0b1116c6a97ee36c5b0a813cae2ad00f42e25743b5b4b700f2b4b12dab4847dc28b0d7a83e0a69d39bb483538672ca1acb2ed4be9f5b
7
+ data.tar.gz: 3a8493c542296cc7ab0bdb8db027fd216ed8861445d421003773211ccc29ede81f4c1995f787f862eb1f4fbc01dc3466f5ef0c901f112de872a4df8a0d422236
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbitek (0.4.0)
4
+ rabbitek (0.4.1)
5
5
  activesupport (> 3.0)
6
6
  bunny (~> 2.11.0)
7
- oj (~> 3.6)
7
+ oj (> 2.0.0)
8
8
  opentracing (~> 0.4)
9
9
  slop (~> 4.0)
10
10
  yabeda
@@ -85,7 +85,7 @@ GEM
85
85
  nio4r (2.5.2)
86
86
  nokogiri (1.10.7)
87
87
  mini_portile2 (~> 2.4.0)
88
- oj (3.10.0)
88
+ oj (3.10.2)
89
89
  opentracing (0.5.0)
90
90
  parallel (1.12.1)
91
91
  parser (2.5.1.2)
@@ -145,7 +145,7 @@ GEM
145
145
  ruby-progressbar (~> 1.7)
146
146
  unicode-display_width (~> 1.0, >= 1.0.1)
147
147
  ruby-progressbar (1.10.0)
148
- slop (4.7.0)
148
+ slop (4.8.0)
149
149
  sprockets (4.0.0)
150
150
  concurrent-ruby (~> 1.0)
151
151
  rack (> 1, < 3)
@@ -161,7 +161,7 @@ GEM
161
161
  websocket-driver (0.7.1)
162
162
  websocket-extensions (>= 0.1.0)
163
163
  websocket-extensions (0.1.4)
164
- yabeda (0.3.0)
164
+ yabeda (0.5.0)
165
165
  concurrent-ruby
166
166
  dry-initializer
167
167
 
@@ -6,7 +6,7 @@ module Rabbitek
6
6
  class Batcher
7
7
  def initialize(consumer)
8
8
  @consumer = consumer
9
- @batch_size = consumer.batch_size
9
+ @batch_size = consumer.opts[:batch][:of]
10
10
  @batch = []
11
11
  end
12
12
 
@@ -52,16 +52,16 @@ module Rabbitek
52
52
  Message.new(delivery_info: delivery_info, properties: properties, payload: payload)
53
53
  end
54
54
 
55
- def batch_size
56
- self.class.batch
55
+ def opts
56
+ self.class.opts
57
57
  end
58
58
 
59
59
  module ClassMethods # rubocop:disable Style/Documentation
60
- attr_accessor :rabbit_options_hash, :batch
60
+ attr_accessor :rabbit_options_hash, :opts
61
61
 
62
62
  def rabbit_options(opts)
63
63
  self.rabbit_options_hash = default_rabbit_options(opts).with_indifferent_access.merge(opts)
64
- self.batch = opts[:batch]
64
+ self.opts = opts
65
65
  end
66
66
 
67
67
  def perform_async(payload, opts: {}, channel: nil)
@@ -13,7 +13,7 @@ module Rabbitek
13
13
  def call(consumer, message)
14
14
  super
15
15
  rescue StandardError
16
- retry_message(consumer, message) unless consumer.batch_size
16
+ retry_message(consumer, message) unless consumer.opts[:batch]
17
17
  raise
18
18
  end
19
19
 
@@ -33,7 +33,7 @@ module Rabbitek
33
33
  def_delegators :starter, :channel, :work_queue, :retry_or_delayed_queue, :retry_or_delayed_exchange
34
34
 
35
35
  def run_job(modified_consumer, message)
36
- if modified_consumer.class.batch
36
+ if modified_consumer.opts[:batch]
37
37
  run_job_batched(modified_consumer, message)
38
38
  else
39
39
  modified_consumer.perform(message)
@@ -44,7 +44,7 @@ module Rabbitek
44
44
  def run_job_batched(modified_consumer, message)
45
45
  Batcher.new(modified_consumer).perform(message) do |batch|
46
46
  modified_consumer.perform(batch)
47
- modified_consumer.ack!(batch.last.delivery_info, true)
47
+ modified_consumer.ack!(batch.last.delivery_info, true) unless modified_consumer.opts[:batch][:manual_ack]
48
48
  end
49
49
  end
50
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rabbitek
4
- VERSION = '0.4.1'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boostcom
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
11
+ date: 2020-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport