Method: RocketJob::Plugins::Job::Model#seconds

Defined in:
lib/rocket_job/plugins/job/model.rb

#secondsObject

Returns [Float] the number of seconds the job has taken

  • Elapsed seconds to process the job from when a worker first started working on it until now if still running, or until it was completed

  • Seconds in the queue if queued



202
203
204
205
206
207
208
209
210
# File 'lib/rocket_job/plugins/job/model.rb', line 202

def seconds
  if completed_at
    completed_at - (started_at || created_at)
  elsif started_at
    Time.now - started_at
  else
    Time.now - created_at
  end
end