lib/rest-ftp-daemon/workers/transfer.rb in rest-ftp-daemon-0.433.0 vs lib/rest-ftp-daemon/workers/transfer.rb in rest-ftp-daemon-0.434.0
- old
+ new
@@ -51,29 +51,29 @@
worker_status WORKER_STATUS_RUNNING, job
job.wid = Thread.current.thread_variable_get :wid
# Processs this job protected by a timeout
Timeout.timeout(@config[:timeout], RestFtpDaemon::JobTimeout) do
- job.process
+ job.start
end
# Increment total processed jobs count
RestFtpDaemon::Counters.instance.increment :jobs, :processed
rescue RestFtpDaemon::JobTimeout => ex
- log_error "JOB TIMEOUT", ex.backtrace
+ log_error "JOB TIMEOUT started_at[#{job.started_at}] started_since[#{job.started_since}] #{ex.message}", ex.backtrace
worker_status WORKER_STATUS_TIMEOUT, job
# Inform the job
- job.oops_you_stop_now ex unless job.nil?
+ job.oops_end(:timeout, ex) unless job.nil?
rescue RestFtpDaemon::AssertionFailed, RestFtpDaemon::JobAttributeMissing, StandardError => ex
- log_error "JOB EXCEPTION ex[#{ex.class}] #{ex.message}", ex.backtrace
+ log_error "JOB CRASHED ex[#{ex.class}] #{ex.message}", ex.backtrace
worker_status WORKER_STATUS_CRASHED
# Inform the job
- job.oops_after_crash ex unless job.nil?
+ job.oops_end(:crashed, ex) unless job.nil?
end
def handle_job_result job
# If job status requires a retry, just restack it
if !job.error
@@ -116,10 +116,10 @@
def error_reached_for job
# Not above, if no limit definded
return false unless @config[:retry_for]
# Job age above this limit
- return job.age >= @config[:retry_for]
+ return job.created_since >= @config[:retry_for]
end
def error_reached_max job
# Not above, if no limit definded
return false unless @config[:retry_max]