class

Mosquito::JobRun

Inherits Reference < Object

A JobRun is a unit of work which will be performed by a Job. JobRuns know how to:

  • store and retrieve their data to and from the datastore
  • figure out what Job class they match to
  • build an instance of that Job class and pass off the config data
  • Ask the job to run

JobRun data is called config and is persisted in the backend under the key mosquito:job_run:job_run_id.

Constants

CONFIG_KEY_PREFIX = "job_run"

Constructors

new(type : String, enqueue_time : Time = Time.utc, id : String | Nil = nil, retry_count : Int32 = 0)
Source

Class methods

config_key(*parts)

The config key is the backend storage key for the metadata of this job_run.

Source
retrieve(id : String)

Used to construct a job_run from the parameters stored in the backend.

Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

Source
build_job

Builds a Job instance from this job_run. Populates the job with config from the backend.

Source
config_key

The config key is the backend storage key for the metadata of this job_run.

Source
delete(in ttl : Int = 0)

Deletes this job_run from the backend. Optionally, after a delay in seconds (handled by the backend).

Source
enqueue_time
Source
fail

Fails this job run and make sure it's persisted as such.

Source
job!
Source
reload

Updates this job_run config from the backend.

Source
reschedule_interval

For the current retry count, how long should a runner wait before retry?

Source
rescheduleable?

For the current retry count, is the job rescheduleable?

Source
retry_count
Source
run

Builds and runs the job with this job_run config.

Source
store

Stores this job run configuration and metadata in the backend.

Source
to_s(io : IO)

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
type
Source