active_publisher 1.3.0.pre0 → 1.3.0.pre1

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: 45653514bae6a0a4516505d102cbbdf19efec6a0
4
- data.tar.gz: 2c3ca2a6b7fb9f38f56885ccb59dfdc327a9df9a
3
+ metadata.gz: 610c3fc6b74529fb45b34285b8e0b5c9668f1740
4
+ data.tar.gz: a7f34b1ec9e70c06a5b7551cf43cb39cb58f0228
5
5
  SHA512:
6
- metadata.gz: 21da8df20e862db89aa28e2d5161b29e14f1ada5f2f46e1f7c9e67cf7fc1a0d27366b9b091242c85f1ecf53a08a571069d785c21d602e9e2c80ce66ab436bc50
7
- data.tar.gz: 4c35c461363239c66846880650f951dcad7d20976c3473513eb87d0ed4f5ac716d14b1fe8f64bb2133bd12c6281f0222b7dffd61eab1b576379be4bc40048c60
6
+ metadata.gz: 4145544e02e5d17d7e6b5683b77d63c71fd414c8debd499f7dac519399d7922e92573619f8e409f243e506f7c88c5791fe30434dfcbd61e1a00b17ca95bda4a2
7
+ data.tar.gz: ae4952b6c8f6d54ade4d9a9e36f894cd4416fc413264bb8a6221a7d14d8c8ea52c81a159e856b36ff5cc52bfdb3c1c09574b7298db8e986dc4cdac3b5cad263a
@@ -9,28 +9,33 @@ module ActivePublisher
9
9
  :timeout_interval => 5, # seconds
10
10
  }
11
11
 
12
- attr_reader :consumer, :queue, :supervisor
12
+ attr_reader :consumers, :queue, :supervisor
13
13
 
14
14
  def initialize(redis_pool)
15
15
  @queue = ::ActivePublisher::Async::RedisAdapter::RedisMultiPopQueue.new(redis_pool, ::ActivePublisher::Async::RedisAdapter::REDIS_LIST_KEY)
16
- create_and_supervise_consumer!
16
+ @consumers = {}
17
+ create_and_supervise_consumers!
17
18
  end
18
19
 
19
- def create_and_supervise_consumer!
20
- @consumer = ::ActivePublisher::Async::InMemoryAdapter::ConsumerThread.new(queue)
21
-
22
- supervisor_task = ::Concurrent::TimerTask.new(SUPERVISOR_INTERVAL) do
23
- # This may also be the place to start additional publishers when we are getting backed up ... ?
24
- unless consumer.alive?
25
- consumer.kill rescue nil
26
- @consumer = ::ActivePublisher::Async::InMemoryAdapter::ConsumerThread.new(queue)
20
+ def create_and_supervise_consumers!
21
+ ::ActivePublisher.configuration.publisher_threads.times do
22
+ consumer_id = ::SecureRandom.uuid
23
+ consumers[consumer_id] = ::ActivePublisher::Async::InMemoryAdapter::ConsumerThread.new(queue)
24
+
25
+ supervisor_task = ::Concurrent::TimerTask.new(SUPERVISOR_INTERVAL) do
26
+ consumer = consumers[consumer_id]
27
+ # This may also be the place to start additional publishers when we are getting backed up ... ?
28
+ unless consumer.alive?
29
+ consumer.kill rescue nil
30
+ consumers[consumer_id] = ::ActivePublisher::Async::InMemoryAdapter::ConsumerThread.new(queue)
31
+ end
32
+
33
+ # Notify the current queue size.
34
+ ::ActiveSupport::Notifications.instrument "redis_async_queue_size.active_publisher", queue.size
27
35
  end
28
36
 
29
- # Notify the current queue size.
30
- ::ActiveSupport::Notifications.instrument "redis_async_queue_size.active_publisher", queue.size
37
+ supervisor_task.execute
31
38
  end
32
-
33
- supervisor_task.execute
34
39
  end
35
40
 
36
41
  def size
@@ -1,3 +1,3 @@
1
1
  module ActivePublisher
2
- VERSION = "1.3.0.pre0"
2
+ VERSION = "1.3.0.pre1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.pre0
4
+ version: 1.3.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Stien
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2018-03-13 00:00:00.000000000 Z
15
+ date: 2018-03-14 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bunny