lib/rest-ftp-daemon/worker.rb in rest-ftp-daemon-0.231.1 vs lib/rest-ftp-daemon/worker.rb in rest-ftp-daemon-0.240.0
- old
+ new
@@ -24,11 +24,11 @@
protected
def log_context
{
wid: @wid,
- tag_1_worker_object: true
+ jid: Thread.current.thread_variable_get(:jid),
}
end
def start
loop do
@@ -39,19 +39,23 @@
sleep 1
end
end
end
- def worker_status status, extra = ""
+ def worker_status status, job = nil
# Update thread variables
Thread.current.thread_variable_set :status, status
Thread.current.thread_variable_set :updted_at, Time.now
# Nothin' to log if "silent"
return unless @log_worker_status_changes
# Log this status change
- log_info "worker: #{status} #{extra}"
+ if job.is_a?(Job)
+ log_info "#{status} - job[#{job.id}] status[#{job.status}] error[#{job.error}]"
+ else
+ log_info "#{status}"
+ end
end
def worker_jid jid
Thread.current.thread_variable_set :jid, jid
Thread.current.thread_variable_set :updted_at, Time.now