action_subscriber 1.5.1.pre0 → 1.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
  SHA1:
3
- metadata.gz: c849d8d45a4a0e167d37823d02d7c5b5be82e501
4
- data.tar.gz: 9547cf8706d8af50904b4a4f87498270916d1110
3
+ metadata.gz: d313afcc25cfffc3977ac51fd000454a5203a302
4
+ data.tar.gz: 6e6b1cef5a1431f8d8b3d1e2f4dc6e11797f21c7
5
5
  SHA512:
6
- metadata.gz: 839968227dcf5b789adf36b489e0d4feb1950399b6657101a2d1a43f6614a895e5d1be30e8c57e4ce35da1a5ea45296ce3efdbb7e9028413a6cc748bbcef8d73
7
- data.tar.gz: 4d928ed945e5dacb26cf3ebf38ff7dd27b3b9603e0722498bb1cfe2d0b8e0c65af1d90cdaabf0b1ad7f9d946b496f5e1cf15cdae263526941246ab2e15df8372
6
+ metadata.gz: 83dba20046583695e060cba67c22cb85effe54a649973d9d08716a25964497214a1496e8f0f7f23f9ed805f999c18ba212dfa1d3551201032eff06f03a9c5d4e
7
+ data.tar.gz: 54e4e53b941c3d2f8f7e86e79d24cf0d53bee320161a812f9bf7e501e392277ee900270e3da495c2ab914d288e54abfd086c5383903ba85dfe48631b77ad11e6
@@ -65,9 +65,7 @@ trap(:USR2) {
65
65
  Action Subscriber Stats
66
66
  Pool Size: #{ ::ActionSubscriber.config.threadpool_size }
67
67
  Ready Size: #{ ::ActionSubscriber::Threadpool.ready_size }
68
- Jobs Waiting in Queue: #{ ::ActionSubscriber::Threadpool.number_of_jobs_queued }
69
68
  CONFIG
70
- ActionSubscriber::Threadpool.print_threadpool_stackraces
71
69
  }
72
70
 
73
71
  ::ActionSubscriber::CLI.start(ARGV)
@@ -37,7 +37,7 @@ module ActionSubscriber
37
37
  def auto_subscribe!
38
38
  queues.each do |route, queue|
39
39
  channel = queue.channel
40
- channel.prefetch(::ActionSubscriber.config.prefetch) if route.acknowledgements?
40
+ channel.prefetch(route.prefetch) if route.acknowledgements?
41
41
  consumer = ::Bunny::Consumer.new(channel, queue, channel.generate_consumer_tag, !route.acknowledgements?)
42
42
  consumer.on_delivery do |delivery_info, properties, encoded_payload|
43
43
  ::ActiveSupport::Notifications.instrument "received_event.action_subscriber", :payload_size => encoded_payload.bytesize, :queue => queue.name
@@ -35,7 +35,7 @@ module ActionSubscriber
35
35
 
36
36
  def auto_subscribe!
37
37
  queues.each do |route,queue|
38
- queue.channel.prefetch = ::ActionSubscriber.config.prefetch if route.acknowledgements?
38
+ queue.channel.prefetch = route.prefetch if route.acknowledgements?
39
39
  consumer = queue.subscribe(route.queue_subscription_options) do |metadata, encoded_payload|
40
40
  ::ActiveSupport::Notifications.instrument "received_event.action_subscriber", :payload_size => encoded_payload.bytesize, :queue => queue.name
41
41
  properties = {
@@ -3,6 +3,7 @@ module ActionSubscriber
3
3
  attr_reader :acknowledgements,
4
4
  :action,
5
5
  :exchange,
6
+ :prefetch,
6
7
  :routing_key,
7
8
  :subscriber,
8
9
  :queue
@@ -11,6 +12,7 @@ module ActionSubscriber
11
12
  @acknowledgements = attributes.fetch(:acknowledgements)
12
13
  @action = attributes.fetch(:action)
13
14
  @exchange = attributes.fetch(:exchange).to_s
15
+ @prefetch = attributes.fetch(:prefetch) { ::ActionSubscriber.config.prefetch }
14
16
  @routing_key = attributes.fetch(:routing_key)
15
17
  @subscriber = attributes.fetch(:subscriber)
16
18
  @queue = attributes.fetch(:queue)
@@ -7,10 +7,6 @@ module ActionSubscriber
7
7
  (pool.pool_size == pool.busy_size)
8
8
  end
9
9
 
10
- def self.number_of_jobs_queued
11
- pool.instance_variable_get('@queued_jobs').size
12
- end
13
-
14
10
  def self.perform_async(*args)
15
11
  self.pool.async.perform(*args)
16
12
  end
@@ -21,16 +17,6 @@ module ActionSubscriber
21
17
  )
22
18
  end
23
19
 
24
- def self.print_threadpool_stackraces
25
- $stderr.puts "ActionSubscriber :: Threadpool stacktraces\n"
26
- pool.instance_variable_get('@busy_threads').each do |thread|
27
- $stderr.puts <<-THREAD_TRACE
28
- #{thread.inspect}:
29
- #{thread.backtrace.try(:join, $INPUT_RECORD_SEPARATOR)}"
30
- THREAD_TRACE
31
- end
32
- end
33
-
34
20
  def self.ready?
35
21
  !busy?
36
22
  end
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "1.5.1.pre0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -53,6 +53,16 @@ describe ActionSubscriber::Router do
53
53
  expect(routes.first.queue).to eq("alice.fake.foo")
54
54
  end
55
55
 
56
+ it "can specify a prefetch value" do
57
+ routes = described_class.draw_routes do
58
+ route FakeSubscriber, :foo, :acknowledgements => true, :prefetch => 10
59
+ route FakeSubscriber, :bar, :acknowledgements => true
60
+ end
61
+
62
+ expect(routes.first.prefetch).to eq(10)
63
+ expect(routes.last.prefetch).to eq(::ActionSubscriber.config.prefetch)
64
+ end
65
+
56
66
  it "can specify the queue" do
57
67
  routes = described_class.draw_routes do
58
68
  route FakeSubscriber, :foo, :publisher => "russell", :queue => "i-am-your-father"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_subscriber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1.pre0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Stien
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-11-24 00:00:00.000000000 Z
15
+ date: 2015-12-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -262,9 +262,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
262
  version: '0'
263
263
  required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  requirements:
265
- - - ">"
265
+ - - ">="
266
266
  - !ruby/object:Gem::Version
267
- version: 1.3.1
267
+ version: '0'
268
268
  requirements: []
269
269
  rubyforge_project:
270
270
  rubygems_version: 2.4.8