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.

/home/runner/work/divider/divider/src/context.qz:29

def class_name -> String

The job's class's name.

/home/runner/work/divider/divider/src/context.qz:31

def queue -> String

Its queue.

/home/runner/work/divider/divider/src/context.qz:33

def attempt -> Int

This attempt's number: 1 for the first.

/home/runner/work/divider/divider/src/context.qz:35

def max_attempts -> Int

The attempts it gets.

/home/runner/work/divider/divider/src/context.qz:37

def inserted_at -> Time

When it was enqueued.

/home/runner/work/divider/divider/src/context.qz:39

def scheduled_at -> Time

When it was due.

/home/runner/work/divider/divider/src/context.qz:41

def repo -> Rotor::Repo

A repository over the worker's pool.

/home/runner/work/divider/divider/src/context.qz:43

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).

/home/runner/work/divider/divider/src/context.qz:48

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

/home/runner/work/divider/divider/src/context.qz:53