promiscuous 0.53.0 → 0.53.1

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.
@@ -16,16 +16,21 @@ module Promiscuous::Config
16
16
  def self.configure(&block)
17
17
  block.call(self)
18
18
 
19
- self.app ||= Rails.application.class.parent_name.underscore rescue nil if defined?(Rails)
19
+ self.app ||= Rails.application.class.parent_name.underscore rescue nil if defined?(Rails)
20
+ self.amqp_url ||= 'amqp://guest:guest@localhost:5672'
21
+ self.redis_url ||= 'redis://localhost/'
22
+ self.backend ||= :rubyamqp
23
+ self.queue_options ||= {:durable => true, :arguments => {'x-ha-policy' => 'all'}}
24
+ self.heartbeat ||= 60
25
+ self.prefetch ||= 1000
26
+ self.logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDERR).tap { |l| l.level = Logger::WARN }
27
+
20
28
  unless self.app
21
29
  raise "Promiscuous.configure: please give a name to your app with \"config.app = 'your_app_name'\""
22
30
  end
23
- self.backend ||= :rubyamqp # amqp connection is done in Promiscuous::AMQP
31
+
32
+ # amqp connection is done in when setting the backend
24
33
  Promiscuous::Redis.connect
25
- self.logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDERR).tap { |l| l.level = Logger::WARN }
26
- self.queue_options ||= {:durable => true, :arguments => {'x-ha-policy' => 'all'}}
27
- self.heartbeat ||= 60
28
- self.prefetch ||= 1000
29
34
  end
30
35
 
31
36
  def self.configured?
@@ -8,6 +8,16 @@ class Promiscuous::Subscriber::Worker < Celluloid::SupervisionGroup
8
8
  pool Runner, :as => :runners, :size => 10
9
9
  supervise MessageSynchronizer, :as => :message_synchronizer
10
10
  supervise Pump, :as => :pump
11
+
12
+ def finalize
13
+ # The order matters as actors depend on each other.
14
+ # This is fixed in the new celluloid, but the gem is not published yet.
15
+ [:pump, :message_synchronizer, :runners].each do |actor_name|
16
+ Celluloid::Actor[actor_name].terminate
17
+ end
18
+ end
11
19
  end
12
20
 
21
+ # Find a better place to put this
13
22
  Celluloid.exception_handler { |e| Promiscuous::Config.error_notifier.try(:call, e) }
23
+ Celluloid.logger = Promiscuous::Config.logger
@@ -31,7 +31,7 @@ class Promiscuous::Subscriber::Worker::Message
31
31
  def ack
32
32
  EM.next_tick do
33
33
  begin
34
- metadata.ack
34
+ metadata.ack if metadata.channel.open?
35
35
  rescue
36
36
  # We don't care if we fail, the message will be redelivered at some point
37
37
  end
@@ -8,7 +8,7 @@ class Promiscuous::Subscriber::Worker::MessageSynchronizer
8
8
 
9
9
  def initialize
10
10
  connect
11
- main_loop!
11
+ async.main_loop
12
12
  end
13
13
 
14
14
  def stop
@@ -171,7 +171,7 @@ class Promiscuous::Subscriber::Worker::MessageSynchronizer
171
171
 
172
172
  def process_message!(msg)
173
173
  @queued_messages -= 1
174
- Celluloid::Actor[:runners].process!(msg)
174
+ Celluloid::Actor[:runners].async.process(msg)
175
175
  end
176
176
 
177
177
  def on_version(key, version, &callback)
@@ -1,3 +1,3 @@
1
1
  module Promiscuous
2
- VERSION = '0.53.0'
2
+ VERSION = '0.53.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promiscuous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.53.0
4
+ version: 0.53.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-09 00:00:00.000000000 Z
13
+ date: 2013-02-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -217,9 +217,9 @@ files:
217
217
  - lib/promiscuous/subscriber/mongoid/embedded_many.rb
218
218
  - lib/promiscuous/subscriber/mongoid/embedded.rb
219
219
  - lib/promiscuous/subscriber/worker/runner.rb
220
+ - lib/promiscuous/subscriber/worker/pump.rb
220
221
  - lib/promiscuous/subscriber/worker/message.rb
221
222
  - lib/promiscuous/subscriber/worker/message_synchronizer.rb
222
- - lib/promiscuous/subscriber/worker/pump.rb
223
223
  - lib/promiscuous/subscriber/active_record.rb
224
224
  - lib/promiscuous/subscriber/envelope.rb
225
225
  - lib/promiscuous/subscriber/upsert.rb
@@ -248,9 +248,9 @@ files:
248
248
  - lib/promiscuous/redis.rb
249
249
  - lib/promiscuous/observer.rb
250
250
  - lib/promiscuous/error.rb
251
- - lib/promiscuous/config.rb
252
251
  - lib/promiscuous/amqp.rb
253
252
  - lib/promiscuous/cli.rb
253
+ - lib/promiscuous/config.rb
254
254
  - lib/promiscuous/version.rb
255
255
  - lib/promiscuous.rb
256
256
  - bin/promiscuous