reactor 0.17.0 → 0.18.0

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
  SHA1:
3
- metadata.gz: bc723686f416100ec5c50b2ff2ccd1893f4c3076
4
- data.tar.gz: 876912b1d837da0b05da0349249811d31e3b82ea
3
+ metadata.gz: b1058e9253784011ae11ef0d90a81d6b03b6adda
4
+ data.tar.gz: 5ac34c6beb094cee626a25f91f2eef3d81c31cbf
5
5
  SHA512:
6
- metadata.gz: 47a87bcef246a5440a573976eac9eb4cc8051938322e0142379ae5f9bff742d97a42fc37ba042380e2895598bc58cc6508c426fb2abf85e2e79fad8a892f8980
7
- data.tar.gz: e8c40d4a7d339263074a3ad2240204f581f43069879d65fc38987f6d5bcd8cc5f83c090278e728fae608c9f81d7a2b1e76140622dbfd5bfc42c62f53a78556f0
6
+ metadata.gz: '0191eb26785cf2a8f269d580539ade48efd533e2add38fb07b1914b1374d35fae5316d74fa8a47cbe41f6c3bccc6935f7f39f6ff1f552ed04dcb13d995b89610'
7
+ data.tar.gz: c9e3c1bd5384f357375ebcd93760fce39c5f8e4e432bf88a820fdbf219566ac286da2946da41b7be0ef34c277a92a5b45c5168c8a26e363f21bbe1204567433a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reactor (0.17.0)
4
+ reactor (0.18.0)
5
5
  rails
6
6
  sidekiq (> 4.0)
7
7
 
data/README.md CHANGED
@@ -95,6 +95,14 @@ end
95
95
  on_event :any_event, in_memory: true do |event|
96
96
  event.target.do_something_about_it_and_make_the_user_wait!
97
97
  end
98
+ ```
99
+
100
+ You may also have Sidekiq process a subscriber block on a specific queue or supply any other Sidekiq::Worker options accordingly.
101
+
102
+ ```ruby
103
+ on_event :event_with_ui_bound, sidekiq_options: { queue: 'highest_priority' } do |event|
104
+ speedily_execute!
105
+ end
98
106
  ```
99
107
 
100
108
  #### ResourceActionable
@@ -2,7 +2,7 @@ module Reactor
2
2
  class Subscription
3
3
 
4
4
  attr_reader :source, :event_name, :action, :handler_name, :delay, :async, :worker_class,
5
- :deprecated
5
+ :deprecated, :sidekiq_options
6
6
 
7
7
  def self.build_handler_name(event_name, handler_name_option = nil)
8
8
  if handler_name_option
@@ -26,6 +26,7 @@ module Reactor
26
26
  @delay = options[:delay].to_i
27
27
  @async = determine_async(options)
28
28
  @deprecated = !!options[:deprecated]
29
+ @sidekiq_options = options[:sidekiq_options] || {}
29
30
  build_worker_class
30
31
  end
31
32
 
@@ -85,6 +86,7 @@ module Reactor
85
86
  self.async = subscription.async
86
87
  self.delay = subscription.delay
87
88
  self.deprecated = subscription.deprecated
89
+ self.sidekiq_options subscription.sidekiq_options
88
90
  end
89
91
  end
90
92
 
@@ -96,6 +98,7 @@ module Reactor
96
98
  self.delay = subscription.delay
97
99
  self.async = subscription.async
98
100
  self.deprecated = subscription.deprecated
101
+ self.sidekiq_options subscription.sidekiq_options
99
102
  end
100
103
  end
101
104
 
@@ -1,3 +1,3 @@
1
1
  module Reactor
2
- VERSION = "0.17.0"
2
+ VERSION = "0.18.0"
3
3
  end
@@ -23,6 +23,11 @@ class Auction < ActiveRecord::Base
23
23
  raise 'hell'
24
24
  end
25
25
 
26
+ on_event :event_with_ui_bound,
27
+ sidekiq_options: { queue: 'highest_priority', retry: false } do |event|
28
+ speedily_execute!
29
+ end
30
+
26
31
  def self.ring_bell(event)
27
32
  "ring ring! #{event}"
28
33
  end
@@ -149,6 +154,18 @@ describe Reactor::Subscribable do
149
154
  end
150
155
  end
151
156
 
157
+ describe 'passing sidekiq_options through to Sidekiq' do
158
+ it 'passes options to Sidekiq API' do
159
+ expect(Reactor::StaticSubscribers::Auction::EventWithUiBoundHandler.get_sidekiq_options).
160
+ to eql({ 'queue' => 'highest_priority', 'retry' => false })
161
+ end
162
+
163
+ it 'keeps default options when none supplied' do
164
+ expect(Reactor::StaticSubscribers::Auction::WildcardHandler.get_sidekiq_options).
165
+ to eql({ 'queue' => 'default', 'retry' => true })
166
+ end
167
+ end
168
+
152
169
  describe '#perform' do
153
170
  around(:each) do |example|
154
171
  Reactor.in_test_mode { example.run }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - winfred
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-12-18 00:00:00.000000000 Z
14
+ date: 2018-01-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  version: '0'
267
267
  requirements: []
268
268
  rubyforge_project:
269
- rubygems_version: 2.6.11
269
+ rubygems_version: 2.6.12
270
270
  signing_key:
271
271
  specification_version: 4
272
272
  summary: Sidekiq/ActiveRecord pubsub lib