1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Include max threads in capacity calculation

This commit is contained in:
schneems 2018-05-04 13:02:44 -05:00
parent 8b10df8b2b
commit a60ceef5ea
2 changed files with 12 additions and 1 deletions

View file

@ -169,8 +169,15 @@ module Puma
end
# This number represents the number of requests that
# the server is capable of taking right now.
#
# For example if the number is 5 then it means
# there are 5 threads sitting idle ready to take
# a request. If one request comes in, then the
# value would be 4 until it finishes processing.
def pool_capacity
@thread_pool and @thread_pool.waiting
@thread_pool and @thread_pool.pool_capacity
end
# Lopez Mode == raw tcp apps

View file

@ -73,6 +73,10 @@ module Puma
@mutex.synchronize { @todo.size }
end
def pool_capacity
waiting + (@max - spawned)
end
# :nodoc:
#
# Must be called with @mutex held!