class

Mosquito::PeriodicJobRun

Inherits Reference < Object

Constructors

new(class __arg0 : ::Mosquito::PeriodicJob.class, interval : Time::MonthSpan | Time::Span)
Source

Instance methods

class

Returns the runtime Class of an object.

1.class       # => Int32
"hello".class # => String

Compare it with typeof, which returns the compile-time type of an object:

random_value = rand # => 0.627423
value = random_value < 0.5 ? 1 : "hello"
value         # => "hello"
value.class   # => String
typeof(value) # => Int32 | String
Source
class=(class __arg0 : Mosquito::PeriodicJob.class)
Source
execute

Enqueues the job for execution

Source
interval
Source
interval=(interval : Time::Span | Time::MonthSpan)
Source
last_executed_at

The last executed timestamp, or "never" if it doesn't exist.

Source
last_executed_at=(time : Time)

Updates the last executed timestamp in the backend, and schedules the metadata for deletion after 3*interval seconds.

For Time::Span intervals, the TTL is set to 3 * interval. For Time::MonthSpan intervals, the TTL is set to approximately 3 * interval.

A month is approximated to 2635200 seconds, or 30.5 days.

Source
last_executed_at?

The last executed timestamp for this periodicjob tracked by the backend.

Source
metadata
Source
try_to_execute

Check the last executed timestamp against the current time, and enqueue the job if it's time to execute.

Source