lib/bmc-daemon-lib/worker.rb in bmc-daemon-lib-0.10.3 vs lib/bmc-daemon-lib/worker.rb in bmc-daemon-lib-0.11.0
- old
+ new
@@ -8,10 +8,11 @@
STATUS_WORKING = "working"
STATUS_SLEEPING = "sleeping"
STATUS_FINISHED = "finished"
STATUS_CRASHED = "crashed"
STATUS_TIMEOUT = "timeout"
+ STATUS_DOWN = "down"
# Class options
attr_reader :pool
attr_reader :wid
@@ -55,20 +56,10 @@
worker_status STATUS_SLEEPING
log_debug "worker_sleep: #{seconds}"
sleep seconds
end
- def working_on_job(job, working_on_it = false)
- if working_on_it
- job.wid = Thread.current.thread_variable_get :wid
- Thread.current.thread_variable_set :jid, job.id
- else
- job.wid = nil
- Thread.current.thread_variable_set :jid, nil
- end
- end
-
def start_loop
log_info "start_loop starting", @config
loop do
begin
# Announce we're waiting for work
@@ -79,10 +70,10 @@
# Should we sleep ?
worker_sleep @config[:timer]
rescue StandardError => e
- log_error "WORKER EXCEPTION: #{e.inspect}"
+ log_error "WORKER EXCEPTION: #{e.inspect}", e.backtrace
sleep 1
end
end
end