Santa
This is a sample Rails 6 app to house an active job adapter implementation.
It has been stripped down to remove distractions. Uses sqlite3 in development for ease of getting started, in practice we'd probably want to mimic production as close as possible.
Notes
- We schedule both
enqueue
andenqueue_at
jobs on the same queue. We could schedule them on different queues to avoid scheduled jobs taking unnecessary power from acute work… but frankly there's no reason to at this time. If it becomes a problem, sure. - There's no support for different job priorities.
Development
- Make sure you have Ruby installed (see
.tool-versions
). - Make sure you have external dependencies installed (see
Brewfile
). - Make sure you have
./config/master.key
. Ask your colleagues! - Run setup,
bin/setup
.
Configuration
GOOGLE_CLOUD_CREDENTIALS
— service account credentials for our Google Cloud account. Retrieved fromENV
in production, but from secret credentials in development.
Google Pub/Sub Considerations
- Work queues (topics/subscriptions) need to be created ahead of time. To do so run
rails active_job:setup
, seelib/tasks/active_job.rake
.bin/setup
does this for you.
Deviations from standard Rails
- Using
.tools-version
instead of.ruby-version
, see https://asdf-vm.com/. - Using rspec instead of minitest.
Testing
- Run the suite through
bin/rails spec
.
Troubleshooting
RuntimeError: grpc cannot be used before and after forking
I hope you're in the console, trying to perform a job. Try this console command:
DISABLE_SPRING=true bin/rails console