class Mosquito::JobRun

Overview

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

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

Defined in:

mosquito/job_run.cr

Constant Summary

CONFIG_KEY_PREFIX = "job_run"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

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

Class Method Detail

def self.config_key(*parts) #

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


def self.retrieve(id : String) #

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


Instance Method Detail

def ==(other : self) #
Description copied from class Reference

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


def build_job : Mosquito::Job #

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


def config_key #

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


def delete(in ttl = 0) #

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


def enqueue_time : Time #

def fail #

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


def id : String #

def job : Mosquito::Job | Nil #

def job! : Mosquito::Job #

def reload : Nil #

Updates this job_run config from the backend.


def reschedule_interval #

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


def rescheduleable? #

For the current retry count, is the job rescheduleable?


def retry_count : Int32 #

def run #

Builds and runs the job with this job_run config.


def store #

Stores this job run configuration and metadata in the backend.


def to_s(io : IO) #
Description copied from class Reference

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>

def type : String #