rabbit_jobs 0.11.4 → 0.11.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rabbit_jobs/main_loop.rb +5 -2
- data/lib/rabbit_jobs/version.rb +1 -1
- data/lib/rabbit_jobs/worker.rb +6 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbaa1fdb2d8e1c9716955755efa130be1eee820e
|
4
|
+
data.tar.gz: f2b6a65de1baff5a6b4696344ac4fe8d7bc5472c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cd1995fc29516e21c31b0cdd5993e0184f06b25eef129d095e39cd83298c89d57206d795023ae21e22c817f947877a9cdedd075ab207e93062b29e99af47924
|
7
|
+
data.tar.gz: dd3ebbf992e689b3afabb00803b7159b89bb9088071b757c38ea3d4174478601ba234c7f2ee440d438768754f990312964cc1dd58242f026b068d82b9c570e63
|
@@ -21,7 +21,10 @@ module RabbitJobs
|
|
21
21
|
|
22
22
|
if @shutdown
|
23
23
|
RabbitJobs.logger.info "Stopping."
|
24
|
-
|
24
|
+
if defined?(amqp_connection) # in worker only
|
25
|
+
amqp_connection.stop
|
26
|
+
amqp_channel.work_pool.join
|
27
|
+
end
|
25
28
|
yield if block_given?
|
26
29
|
return true
|
27
30
|
end
|
@@ -38,4 +41,4 @@ module RabbitJobs
|
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
41
|
-
end
|
44
|
+
end
|
data/lib/rabbit_jobs/version.rb
CHANGED
data/lib/rabbit_jobs/worker.rb
CHANGED
@@ -17,6 +17,10 @@ module RabbitJobs
|
|
17
17
|
properties: Bunny::Session::DEFAULT_CLIENT_PROPERTIES.merge(product: "rj_worker #{Process.pid}")).start
|
18
18
|
end
|
19
19
|
|
20
|
+
def amqp_channel
|
21
|
+
@amqp_channel ||= amqp_connection.create_channel
|
22
|
+
end
|
23
|
+
|
20
24
|
def self.cleanup
|
21
25
|
conn = Thread.current[:rj_worker_connection]
|
22
26
|
conn.close if conn && conn.status != :not_connected
|
@@ -60,11 +64,10 @@ module RabbitJobs
|
|
60
64
|
@processed_count = 0
|
61
65
|
|
62
66
|
begin
|
63
|
-
amqp_channel = amqp_connection.create_channel
|
64
67
|
amqp_channel.prefetch(1)
|
65
68
|
|
66
69
|
queues.each do |routing_key|
|
67
|
-
consume_queue(
|
70
|
+
consume_queue(routing_key)
|
68
71
|
end
|
69
72
|
|
70
73
|
RJ.logger.info "Started."
|
@@ -110,7 +113,7 @@ module RabbitJobs
|
|
110
113
|
end
|
111
114
|
end
|
112
115
|
|
113
|
-
def consume_queue(
|
116
|
+
def consume_queue(routing_key)
|
114
117
|
RJ.logger.info "Subscribing to #{routing_key}"
|
115
118
|
routing_key = routing_key.to_sym
|
116
119
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbit_jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Lazureykis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.0.
|
207
|
+
rubygems_version: 2.0.0
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: Background jobs on RabbitMQ
|