beanstalker 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.4.7
data/beanstalker.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beanstalker}
8
- s.version = "0.4.6"
8
+ s.version = "0.4.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gleb Pomykalov"]
@@ -96,6 +96,10 @@ class Beanstalker::Worker
96
96
  def q_hint
97
97
  @q_hint || Beanstalker::Queue.queue
98
98
  end
99
+
100
+ def logger
101
+ Daemonizer.logger or RAILS_DEFAULT_LOGGER
102
+ end
99
103
 
100
104
  # This heuristic is to help prevent one queue from starving. The idea is that
101
105
  # if the connection returns a job right away, it probably has more available.
@@ -198,15 +202,15 @@ class Beanstalker::Worker
198
202
  }
199
203
  if @options[:ruby_timeout]
200
204
  timeout = (job.stats['ttr'].to_f * 0.8)
201
- Daemonizer.logger.info "TO=#{timeout} sec. Job id=#{job.stats['id']}. Running '#{job[:code]}'. Age #{job.stats['age']}, Releases #{job.stats['releases']}, TTR #{job.stats['ttr']}"
205
+ logger.info "TO=#{timeout} sec. Job id=#{job.stats['id']}. Running '#{job[:code]}'. Age #{job.stats['age']}, Releases #{job.stats['releases']}, TTR #{job.stats['ttr']}"
202
206
  Timeout.timeout(timeout) do
203
207
  runner.call
204
208
  end
205
209
  else
206
- Daemonizer.logger.info "Job id=#{job.stats['id']}. Running '#{job[:code]}'. Age #{job.stats['age']}, Releases #{job.stats['releases']}, TTR #{job.stats['ttr']}"
210
+ logger.info "Job id=#{job.stats['id']}. Running '#{job[:code]}'. Age #{job.stats['age']}, Releases #{job.stats['releases']}, TTR #{job.stats['ttr']}"
207
211
  runner.call
208
212
  end
209
- Daemonizer.logger.info "Finished"
213
+ logger.info "Finished"
210
214
  end
211
215
 
212
216
  def run_code(job)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beanstalker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 6
10
- version: 0.4.6
9
+ - 7
10
+ version: 0.4.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gleb Pomykalov