Skip to content

Commit f0aa45c

Browse files
committed
document connection pool size constraint for max_claims
1 parent dea0914 commit f0aa45c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,16 @@ workers will sleep for 5 seconds.
442442

443443
```ruby
444444
# The max number of jobs a worker may lock at a time (also the size of the thread pool):
445+
# NOTE: This should be less than your ActiveRecord connection pool size. The worker process
446+
# itself needs one connection for polling and locking, so if max_claims >= pool_size, a job
447+
# thread that cannot check out a connection within the checkout timeout may raise
448+
# ActiveRecord::ConnectionTimeoutError. The worker will log a warning at startup if this
449+
# is detected.
450+
#
451+
# For example, if your pool size is 5, set max_claims to 4:
452+
#
453+
# # config/initializers/delayed_job.rb
454+
# Delayed::Worker.max_claims = ActiveRecord::Base.connection_pool.size - 1
445455
Delayed::Worker.max_claims = 5
446456

447457
# The number of jobs to which a worker may "read ahead" when locking jobs (mysql only!):

0 commit comments

Comments
 (0)