Skip to content

Commit 119411a

Browse files
committed
Use RAILS_MAX_THREADS in ActiveJob::AsyncAdapter
1 parent 4a45f31 commit 119411a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

activejob/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
* Use `RAILS_MAX_THREADS` in `ActiveJob::AsyncAdapter`. If it is not set, use 5 as default.
2+
3+
*heka1024*
14

25
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activejob/CHANGELOG.md) for previous changes.

activejob/lib/active_job/queue_adapters/async_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def perform
7474
class Scheduler # :nodoc:
7575
DEFAULT_EXECUTOR_OPTIONS = {
7676
min_threads: 0,
77-
max_threads: Concurrent.processor_count,
77+
max_threads: ENV.fetch("RAILS_MAX_THREADS", 5).to_i,
7878
auto_terminate: true,
7979
idletime: 60, # 1 minute
8080
max_queue: 0, # unlimited

0 commit comments

Comments
 (0)