rabbit_jobs 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module RabbitJobs
14
14
  class << self
15
15
 
16
16
  def prepare_connection(conn)
17
- if !conn
17
+ if !conn || conn.closed?
18
18
  RJ.logger.info("Connecting to #{RJ.config.servers.first.to_s}...")
19
19
  conn = AMQP.connect(RJ.config.servers.first, auto_recovery: AUTO_RECOVERY_ENABLED)
20
20
  init_auto_recovery(conn) if AUTO_RECOVERY_ENABLED
@@ -22,6 +22,10 @@ module RabbitJobs
22
22
  self._channel ||= AmqpHelper.create_channel(self._connection)
23
23
  end
24
24
 
25
+ def cleanup
26
+ self._connection = self._channel = nil
27
+ end
28
+
25
29
  def publish(klass, *params, &block)
26
30
  publish_to(RJ.config.default_queue, klass, *params, &block)
27
31
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module RabbitJobs
4
- VERSION = "0.5.3"
4
+ VERSION = "0.5.4"
5
5
  end
@@ -14,6 +14,10 @@ module RabbitJobs
14
14
  self._channel ||= AmqpHelper.create_channel(self._connection)
15
15
  end
16
16
 
17
+ def cleanup
18
+ self._connection = self._channel = nil
19
+ end
20
+
17
21
  def process_message(metadata, payload)
18
22
  job = RJ::Job.parse(payload)
19
23
 
data/lib/rabbit_jobs.rb CHANGED
@@ -31,6 +31,8 @@ module RabbitJobs
31
31
  alias_method :run, :start
32
32
 
33
33
  def stop
34
+ RJ::Publisher.cleanup
35
+
34
36
  if AMQP.connection
35
37
  AMQP.connection.disconnect {
36
38
  AMQP.connection = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amqp
16
- requirement: &6711200 !ruby/object:Gem::Requirement
16
+ requirement: &10580660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *6711200
24
+ version_requirements: *10580660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &6710280 !ruby/object:Gem::Requirement
27
+ requirement: &10578980 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *6710280
35
+ version_requirements: *10578980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rufus-scheduler
38
- requirement: &6709080 !ruby/object:Gem::Requirement
38
+ requirement: &10577880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *6709080
46
+ version_requirements: *10577880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rails
49
- requirement: &7102960 !ruby/object:Gem::Requirement
49
+ requirement: &10975800 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *7102960
57
+ version_requirements: *10975800
58
58
  description: Background jobs on RabbitMQ
59
59
  email:
60
60
  - lazureykis@gmail.com
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -2342722685438504557
118
+ hash: 3005996049584055146
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: -2342722685438504557
127
+ hash: 3005996049584055146
128
128
  requirements: []
129
129
  rubyforge_project:
130
130
  rubygems_version: 1.8.11