Skip to content

Commit

Permalink
Update cron documentation to remove confusion about multiple processes (
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon authored Aug 12, 2024
1 parent a61fc09 commit 59c3300
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,7 @@ GoodJob's concurrency control strategy for `perform_limit` is "optimistic retry
GoodJob can enqueue Active Job jobs on a recurring basis that can be used as a replacement for cron.
Cron-style jobs can be performed by any GoodJob process (e.g., CLI or `:async` execution mode) that has `config.good_job.enable_cron` set to `true`. That is, one or more job executor processes can be configured to perform recurring jobs.
GoodJob's cron uses unique indexes to ensure that only a single job is enqueued at the given time interval. In order for this to work, GoodJob must preserve cron-created job records; these records will be automatically deleted like any other preserved record.
Cron-style jobs can be enequeued by any GoodJob process (e.g., CLI or `:async` execution mode) that has `config.good_job.enable_cron` set to `true`. Enabling cron on multiple processes will not enqueue duplicate jobs; GoodJob's cron uses unique indexes to ensure that only a single job is enqueued for a given time interval. In order for this to work, GoodJob must preserve cron-created job records; these records will be automatically deleted like any other preserved record.
Cron-format is parsed by the [`fugit`](https://github.com/floraison/fugit) gem, which has support for seconds-level resolution (e.g. `* * * * * *`) and natural language parsing (e.g. `every second`).
Expand All @@ -624,8 +622,8 @@ If you use the [Dashboard](#dashboard) the scheduled tasks can be viewed in the
```ruby
# config/environments/application.rb or a specific environment e.g. production.rb
# Enable cron in this process, e.g., only run on the first Heroku worker process
config.good_job.enable_cron = ENV['DYNO'] == 'worker.1' # or `true` or via $GOOD_JOB_ENABLE_CRON
# Enable cron enqueuing in this process
config.good_job.enable_cron = true
# Configure cron with a hash that has a unique key for each recurring job
config.good_job.cron = {
Expand Down

0 comments on commit 59c3300

Please sign in to comment.