promiscuous 0.52.1 → 0.53.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,14 +13,24 @@ class Promiscuous::CLI
13
13
  end
14
14
  end
15
15
  end
16
+
17
+ %w(SIGTERM SIGINT).each do |signal|
18
+ Signal.trap(signal) do
19
+ print_status "Exiting..."
20
+ @worker.terminate if @worker.try(:alive?)
21
+ @stop = true
22
+ end
23
+ end
16
24
  end
17
25
 
18
26
  def publish
19
27
  options[:criterias].map { |criteria| eval(criteria) }.each do |criteria|
28
+ break if @stop
20
29
  title = criteria.name
21
30
  title = "#{title}#{' ' * [0, 20 - title.size].max}"
22
31
  bar = ProgressBar.create(:format => '%t |%b>%i| %c/%C %e', :title => title, :total => criteria.count)
23
32
  criteria.each do |doc|
33
+ break if @stop
24
34
  doc.promiscuous_sync
25
35
  bar.increment
26
36
  end
@@ -29,10 +39,10 @@ class Promiscuous::CLI
29
39
 
30
40
  def subscribe
31
41
  Promiscuous::Loader.load_descriptors if defined?(Rails)
42
+ @worker = Promiscuous::Subscriber::Worker.run!
43
+ Celluloid::Actor[:pump].subscribe_sync.wait
32
44
  print_status "Replicating with #{Promiscuous::Subscriber::AMQP.subscribers.count} subscribers"
33
- Promiscuous::Subscriber::Worker.run
34
- rescue Interrupt
35
- # SIGINT
45
+ sleep 1 until !@worker.alive?
36
46
  end
37
47
 
38
48
  def parse_args(args)
@@ -1,3 +1,3 @@
1
1
  module Promiscuous
2
- VERSION = '0.52.1'
2
+ VERSION = '0.53.0'
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.52.1
4
+ version: 0.53.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: