mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Micro optimisations in wait_for_less_busy_worker feature (#2579)
* Micro optimisations in `wait_for_less_busy_worker` feature Two small things: - https://github.com/puma/puma/pull/2079/files#r422738756 -> swap the order of calls so that the faster call (float comparison) runs first. - https://github.com/puma/puma/pull/2079/files#r596114279 -> don't call `.to_f` on option that we already know is a float. * Update server.rb * Update thread_pool.rb * Update thread_pool.rb
This commit is contained in:
parent
af94b78320
commit
78cf164e35
2 changed files with 3 additions and 3 deletions
|
|
@ -327,8 +327,7 @@ module Puma
|
|||
break if handle_check
|
||||
else
|
||||
pool.wait_until_not_full
|
||||
pool.wait_for_less_busy_worker(
|
||||
@options[:wait_for_less_busy_worker].to_f)
|
||||
pool.wait_for_less_busy_worker(@options[:wait_for_less_busy_worker])
|
||||
|
||||
io = begin
|
||||
sock.accept_nonblock
|
||||
|
|
|
|||
|
|
@ -240,11 +240,12 @@ module Puma
|
|||
|
||||
# @version 5.0.0
|
||||
def wait_for_less_busy_worker(delay_s)
|
||||
return unless delay_s && delay_s > 0
|
||||
|
||||
# Ruby MRI does GVL, this can result
|
||||
# in processing contention when multiple threads
|
||||
# (requests) are running concurrently
|
||||
return unless Puma.mri?
|
||||
return unless delay_s > 0
|
||||
|
||||
with_mutex do
|
||||
return if @shutdown
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue