rabbit_jobs 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ require 'rabbit_jobs'
4
4
  require 'json'
5
5
 
6
6
  RabbitJobs.configure do |c|
7
- c.url "amqp://localhost"
7
+ c.url "amqp://localhost/"
8
8
 
9
9
  c.exchange 'test_exchange', durable: true, auto_delete: false
10
10
 
@@ -25,7 +25,7 @@ module RabbitJobs
25
25
 
26
26
  unless @@configuration
27
27
  self.configure do |c|
28
- c.url 'amqp://localhost'
28
+ c.url 'amqp://localhost/'
29
29
  c.exchange 'rabbit_jobs', auto_delete: false, durable: true
30
30
  c.queue 'default', auto_delete: false, ack: true, durable: true
31
31
  end
@@ -61,7 +61,7 @@ module RabbitJobs
61
61
  def initialize
62
62
  @data = {
63
63
  error_log: true,
64
- url: 'amqp://localhost',
64
+ url: 'amqp://localhost/',
65
65
  exchange: 'rabbit_jobs',
66
66
  exchange_params: DEFAULT_EXCHANGE_PARAMS,
67
67
  queues: {}
@@ -119,7 +119,7 @@ module RabbitJobs
119
119
  @data[:url] = value.to_s
120
120
  @data[:connection_options] = nil
121
121
  else
122
- @data[:url] || 'amqp://localhost'
122
+ @data[:url] || 'amqp://localhost/'
123
123
  end
124
124
  end
125
125
 
@@ -31,9 +31,8 @@ module RabbitJobs::Job
31
31
  if defined?(MongoMapper)
32
32
  MongoMapper.database.connection.connect_to_master
33
33
  end
34
- # RJ.logger.debug 'before perform'
34
+
35
35
  self.class.perform(*params)
36
- # RJ.logger.debug 'after perform'
37
36
  rescue
38
37
  RJ.logger.warn(self.inspect)
39
38
  RJ.logger.warn([$!.inspect, $!.backtrace.to_a].join("\n"))
@@ -60,6 +60,7 @@ module RabbitJobs
60
60
  def self.with_bunny(&block)
61
61
  raise ArgumentError unless block
62
62
 
63
+ # raise RJ.config.connection_options.inspect
63
64
  Bunny.run(RJ.config.connection_options.merge({logging: false})) do |bunny|
64
65
  block.call(bunny)
65
66
  end
@@ -124,7 +124,16 @@ module RabbitJobs
124
124
  # prune_dead_workers
125
125
  RabbitJobs::Util.check_pidfile(self.pidfile) if self.pidfile
126
126
 
127
- Process.daemon(true) if self.background
127
+ if self.background
128
+ Process.daemon(true)
129
+
130
+ if defined?(ActiveRecord::Base)
131
+ ActiveRecord::Base.establish_connection
132
+ end
133
+ if defined?(MongoMapper)
134
+ MongoMapper.database.connection.connect_to_master
135
+ end
136
+ end
128
137
 
129
138
  if self.pidfile
130
139
  File.open(self.pidfile, 'w') { |f| f << Process.pid }
@@ -1,3 +1,3 @@
1
1
  module RabbitJobs
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
@@ -108,6 +108,13 @@ module RabbitJobs
108
108
  else
109
109
  # daemonize child process
110
110
  Process.daemon(true)
111
+
112
+ if defined?(ActiveRecord::Base)
113
+ ActiveRecord::Base.establish_connection
114
+ end
115
+ if defined?(MongoMapper)
116
+ MongoMapper.database.connection.connect_to_master
117
+ end
111
118
  end
112
119
  end
113
120
 
@@ -7,6 +7,7 @@ describe RabbitJobs::Publisher do
7
7
 
8
8
  before(:each) do
9
9
  RabbitJobs.configure do |c|
10
+ c.url 'amqp://localhost/'
10
11
  c.exchange 'test'
11
12
  c.queue 'rspec_queue'
12
13
  c.queue 'rspec_queue2'
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.1.10
4
+ version: 0.1.11
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: 2012-05-10 00:00:00.000000000 Z
12
+ date: 2012-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amqp
16
- requirement: &70306208435960 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70306208435960
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.9'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: bunny
27
- requirement: &70306208435000 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0.7'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70306208435000
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.7'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rake
38
- requirement: &70306208433540 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70306208433540
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rufus-scheduler
49
- requirement: &70306208431520 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,7 +69,12 @@ dependencies:
54
69
  version: '2.0'
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70306208431520
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '2.0'
58
78
  description: Background jobs on RabbitMQ
59
79
  email:
60
80
  - lazureykis@gmail.com
@@ -109,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
129
  version: '0'
110
130
  segments:
111
131
  - 0
112
- hash: -1920366200643648067
132
+ hash: -4338471545654317005
113
133
  required_rubygems_version: !ruby/object:Gem::Requirement
114
134
  none: false
115
135
  requirements:
@@ -118,10 +138,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
138
  version: '0'
119
139
  segments:
120
140
  - 0
121
- hash: -1920366200643648067
141
+ hash: -4338471545654317005
122
142
  requirements: []
123
143
  rubyforge_project:
124
- rubygems_version: 1.8.15
144
+ rubygems_version: 1.8.24
125
145
  signing_key:
126
146
  specification_version: 3
127
147
  summary: Background jobs on RabbitMQ