lapine 0.2.8 → 0.2.9

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: 1001cd5da440647b8239d6707856cc5cc9beece5
4
- data.tar.gz: a96e6b8872ac1d2c97be49276f7f6e5b4e74eab1
3
+ metadata.gz: 00c5975716fde4c26b9c4f07e975ceafb7c5fc52
4
+ data.tar.gz: 4eea9f3c8a607fa6b40d7461b266a2abd354012b
5
5
  SHA512:
6
- metadata.gz: 53c391e0bd380251371e3d34aa15eae90f487f2bcd916e01b10a48a2c20c1aa292dd57581ef69309fe2d2a93f489e1827a78a3e24ac2f072ff1ee97b15bcec33
7
- data.tar.gz: f697bc707ed1cb0d60829610e5f2c3d78179532f30188f02ade417b94ccfbb1d3bf9977f7cb5d2140538d0142144a54f8d62e6d38d55fce22429088ba4095d5b
6
+ metadata.gz: db1368b8ae7112b58968ad0992e64242f20288cd4a9140fd531921cff03d13537625aeaf87a54d83b4fc20b10dd7ea3a17f1270a5005e36e94676318cac0bb86
7
+ data.tar.gz: f20f048d5e86cea988b11ae1d2f080d2da529266d50a55b95831118ee69818da26bb0806958d2915d9791284e58b341e8f37e9ab18efc191a59efeda0d0da7d1
@@ -38,6 +38,8 @@ module Lapine
38
38
  @running_message_count += 1
39
39
  end
40
40
  metadata.ack
41
+
42
+ EventMachine.stop_event_loop if should_exit?
41
43
  end
42
44
  end
43
45
 
@@ -47,6 +49,10 @@ module Lapine
47
49
  @message_count = 0
48
50
  end
49
51
  end
52
+
53
+ EventMachine.add_periodic_timer(5) do
54
+ EventMachine.stop_event_loop if should_exit?
55
+ end
50
56
  end
51
57
 
52
58
  logger.warn 'exiting Lapine::Consumer'
@@ -70,9 +76,14 @@ module Lapine
70
76
  end
71
77
  end
72
78
 
79
+ def should_exit?
80
+ $STOP_LAPINE_CONSUMER
81
+ end
82
+
73
83
  def handle_signals!
84
+ $STOP_LAPINE_CONSUMER = false
74
85
  Signal.trap('INT') { EventMachine.stop }
75
- Signal.trap('TERM') { EventMachine.stop }
86
+ Signal.trap('TERM') { $STOP_LAPINE_CONSUMER = true }
76
87
  end
77
88
  end
78
89
  end
@@ -1,3 +1,3 @@
1
1
  module Lapine
2
- VERSION = '0.2.8'
2
+ VERSION = '0.2.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lapine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Saxby
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-29 00:00:00.000000000 Z
12
+ date: 2015-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amqp
@@ -233,4 +233,3 @@ test_files:
233
233
  - spec/lib/lapine_spec.rb
234
234
  - spec/spec_helper.rb
235
235
  - spec/support/rspec_test_helper.rb
236
- has_rdoc: