Skip to content

Commit

Permalink
Fix default polling interval (#362)
Browse files Browse the repository at this point in the history
Uses a different Sidekiq option because average_scheduled_poll_interval
has a default value of 5 seconds.
  • Loading branch information
engwan authored Sep 19, 2022
1 parent 7acecde commit 67db8a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ For example: `"*/30 * * * * *"` would schedule a job to run every 30 seconds.
Note that if you plan to schedule jobs with second precision you may need to override the default schedule poll interval so it is lower than the interval of your jobs:

```ruby
Sidekiq[:average_scheduled_poll_interval] = 10
Sidekiq[:cron_poll_interval] = 10
```

The default value at time of writing is 30 seconds. See [under the hood](#under-the-hood) for more details.
Expand Down Expand Up @@ -332,7 +332,7 @@ Sidekiq-Cron adds itself into this start procedure and starts another thread wit
Sidekiq-Cron is checking jobs to be enqueued every 30s by default, you can change it by setting:

```ruby
Sidekiq[:average_scheduled_poll_interval] = 10
Sidekiq[:cron_poll_interval] = 10
```

Sidekiq-Cron is safe to use with multiple Sidekiq processes or nodes. It uses a Redis sorted set to determine that only the first process who asks can enqueue scheduled jobs into the queue.
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/cron/poller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def enqueue_job(job, time = Time.now.utc)
end

def poll_interval_average
@config[:average_scheduled_poll_interval] || POLL_INTERVAL
@config[:cron_poll_interval] || POLL_INTERVAL
end
end
end
Expand Down

0 comments on commit 67db8a1

Please sign in to comment.