creeper 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -117,7 +117,6 @@ module Creeper
117
117
  log_error "*** Failed connection to #{beanstalk_url}"
118
118
  log_error "*** Check that beanstalkd is running (or set a different BEANSTALK_URL)"
119
119
  end
120
-
121
120
 
122
121
  def log(msg)
123
122
  Creeper.logger.info(msg)
@@ -1,3 +1,3 @@
1
1
  module Creeper
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -84,7 +84,7 @@ module Creeper
84
84
  tubes.each { |tube| beanstalk.ignore(tube) unless jobs.include?(tube) }
85
85
  end
86
86
  rescue Beanstalk::NotConnected => e
87
- failed_connection(e)
87
+ log_exception("worker[#{@thread.inspect}] failed beanstalk connection", e)
88
88
  end
89
89
 
90
90
  def work
@@ -111,12 +111,12 @@ module Creeper
111
111
  job.delete
112
112
  log_job_end(name, args)
113
113
  rescue Beanstalk::NotConnected => e
114
- failed_connection(e)
115
- rescue SystemExit
116
-
114
+ log_exception("worker[#{@thread.inspect}] failed beanstalk connection", e)
115
+ rescue SystemExit => e
116
+ log_exception("worker[#{@thread.inspect}] exit", e)
117
117
  raise
118
118
  rescue => e
119
- log_error exception_message(e)
119
+ log_exception("worker[#{@thread.inspect}] loop error", e)
120
120
  job.bury rescue nil
121
121
  args ||= []
122
122
  log_job_end(name, args, 'failed') if @job_begun
@@ -138,19 +138,12 @@ module Creeper
138
138
  def stop
139
139
  logger.info "worker dying: (current=#{Thread.current.inspect}#{@thread.inspect}"
140
140
  session.disconnect
141
+ sleep 1
141
142
  @thread.kill
142
143
  end
143
144
 
144
145
  protected
145
146
 
146
- def failed_connection(e)
147
- session.send(:failed_connection, e)
148
- end
149
-
150
- def exception_message(e)
151
- session.send(:exception_message, e)
152
- end
153
-
154
147
  def log_job_begin(name, args)
155
148
  @working = true
156
149
  args_flat = flatten_args(args)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -132,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  segments:
134
134
  - 0
135
- hash: -2251731633976259583
135
+ hash: 1683539863185773873
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  segments:
143
143
  - 0
144
- hash: -2251731633976259583
144
+ hash: 1683539863185773873
145
145
  requirements: []
146
146
  rubyforge_project:
147
147
  rubygems_version: 1.8.23