Merge pull request #52468 from heka1024/available-processor-count-in-async-adapter

Use `RAILS_MAX_THREADS` in `ActiveJob::AsyncAdapter`
This commit is contained in:
Jean Boussier 2024-08-02 14:34:23 +02:00 committed by GitHub
commit a0a894cecb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -1,2 +1,5 @@
* Use `RAILS_MAX_THREADS` in `ActiveJob::AsyncAdapter`. If it is not set, use 5 as default.
*heka1024*
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activejob/CHANGELOG.md) for previous changes.

View File

@ -74,7 +74,7 @@ module ActiveJob
class Scheduler # :nodoc:
DEFAULT_EXECUTOR_OPTIONS = {
min_threads: 0,
max_threads: Concurrent.processor_count,
max_threads: ENV.fetch("RAILS_MAX_THREADS", 5).to_i,
auto_terminate: true,
idletime: 60, # 1 minute
max_queue: 0, # unlimited