class Divider::Context
What a running job's perform is told of its attempt, and its
repository: repo is a Rotor::Repo over the worker's pool, made for
this attempt (each statement takes a connection; a transaction holds
one), or the test's repository under Divider::Testing.
class PurgeSessions < Divider::Job
def perform(job: Divider::Context) -> Void
job.repo.exec("DELETE FROM sessions WHERE expires_at < now()")
end
end
/home/runner/work/divider/divider/src/context.qz:13
Methods
def id -> Int
The job's id.
def class_name -> String
The job's class's name.
def queue -> String
Its queue.
def attempt -> Int
This attempt's number: 1 for the first.
def max_attempts -> Int
The attempts it gets.
def inserted_at -> Time
When it was enqueued.
def scheduled_at -> Time
When it was due.
def repo -> Rotor::Repo
A repository over the worker's pool.
def cancel_requested? -> Bool
Whether Divider.cancel asked the job to stop (a query): a long job
polls it, and raises Divider::Cancelled to stop, which ends it
cancelled (returning instead ends it completed).
def inspect -> String
A developer-readable representation, as p prints it: strings quoted,
collections with their elements' inspect, an object with its fields
(#<Point @x=1, @y=2>).
from Object