A Jets job handles background jobs. They run outside of the web request/response cycle. Here’s an example:


class HardJob < ApplicationJob
  class_timeout 300

  rate "10 hours" # every 10 hours
  def dig
    puts "done digging"

  cron "0 */12 * * ? *" # every 12 hours
  def lift
    puts "done lifting"

HardJob#dig will run every 10 hours and HardJob#lift will run every 12 hours.

You can check for the job functions in the Lambda console:

You can also see associated CloudWatch Event Rule in the CloudWatch console:

Running Jobs Explicitly

You can run jobs explicitly with code. Example:

event = {key1: "value1"}
HardJob.perform_now(:dig, event)
HardJob.perform_later(:lift, event)

In the example above, the perform_now results in the job running in the same process.

The perform_later runs the job by calling the AWS Lambda function associated with it in a new process. It usually runs a few seconds later.

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!