Skip to main content
Version: v3.0

Background Jobs

ActiveJob backed by Solid Queue is the basis for background and scheduled jobs in Rhino Jobs.

By default Rhino configures Solid Queue to run in single database form for ease of deployment, but does not use Solid Queue in development or test environments by default.

The queues can be configured in config/queue.yml and recurring tasks in config/recurring.yml.

Creating a job

Create a job with standard rails generator:

rails g job Test

Running a job

TestJob.perform_later

Processing the queue

Setting the environment variable SOLID_QUEUE_IN_PUMA or running bin/jobs will have the puma web server process the queue, including scheduled jobs.

Monitoring jobs

Rhino installs and configures Mission Control Jobs to monitor jobs. The dashboard is available at /jobs with an admin user.

Scaling

The first step in scaling is to run the workers outside of the web server with bin/jobs. The Heroku Procfile and heroku.yml is already configured to run bin/jobs. Simply enable the

tip

Make sure to remove the SOLID_QUEUE_IN_PUMA environment variable from the web server if you run bin/jobs in a separate process.

Next is to run multiple workers. This can be done by running bin/jobs on multiple servers.

If performance continues to be a bottleneck, the move the Solid Queue database to a separate database - revert theQueueSchema migration and reinstall the Solid Queue database with bin/rails solid_queue:install - see https://github.com/rails/solid_queue?tab=readme-ov-file#installation for more information.