Class: Exekutor::Job

Inherits:
Internal::BaseRecord show all
Defined in:
lib/exekutor/job.rb

Overview

Active record instance for a job

Instance Method Summary collapse

Instance Method Details

#discard!Object

Sets the status to discarded.



27
28
29
# File 'lib/exekutor/job.rb', line 27

def discard!
  update! status: "d"
end

#release!Object

Sets the status to pending and clears the assigned worker



16
17
18
# File 'lib/exekutor/job.rb', line 16

def release!
  update! status: "p", worker_id: nil
end

#reschedule!(at: Time.current) ⇒ Object

Sets the status to pending, clears the assigned worker, and schedules execution at the indicated time.

Parameters:

  • at (Time) (defaults to: Time.current)

    when the job should be executed



22
23
24
# File 'lib/exekutor/job.rb', line 22

def reschedule!(at: Time.current)
  update! status: "p", scheduled_at: at, worker_id: nil, runtime: nil
end