* Simplify `ThreadPool` initializations code in `Puma::Server`
This commit introduces four `ThreadPool` options in `Configuration::DEFAULTS`:
`auto_trim_time`, `reaping_time`, `clean_thread_locals`, and
`out_of_band_hook` they could be configured via file/user options
`Puma::Configuration`.
The auto reap/trim methods stay in `Puma::Server` because the way we test
in `Puma::Server` tests.
Adds `slice(keys)` method to `UserFileDefaultOptions` so it acts
like a Hash and we could read `ThreadPool` options from the user-file-default options.
Adds missing require statement to `test/test_puma_server.rb`, so this test
could run individually.
Co-Authored-By: Shohei Umemoto <cafedomancer@gmail.com>
Co-Authored-By: Nate Berkopec <nate.berkopec@gmail.com>
* Fix out of band
* Fixup lib files
* Fixup tests
Co-authored-by: Juanito Fatas <me@juanitofatas.com>
Co-authored-by: Shohei Umemoto <cafedomancer@gmail.com>
Co-authored-by: MSP-Greg <Greg.mpls@gmail.com>
* Extract calls to purge_interrupt_queue
Move calls to Thread#purge_interrupt_queue to a module function. This
means if/when this pattern needs to change it can change in one place
instead of a dozen or more places.
* Update comment on purge_interrupt_queue [ci skip]
* Actions non MRI - use JDK11 on macOS, add Big Sur
* Actions MRI - add macOS Big Sur Ruby 2.7
* test/helper.rb - run setup in same Timeout block as test
* TestIntegrationSingle#test_int_refuse - skip on JRuby
Seems to intermittently lockup CI
* TestLauncher#test_puma_stats - fix intermittent non-MRI failure II
* test_out_of_band_server.rb - JRuby - add small sleep after server.run
* test_persistent.rb - JRuby - add small sleep after server.run
* test_puma_server.rb - JRuby - add small sleep after server.run
* Improve OOB hook
This moves the hook to be executed outside of busy loop
considering the thread to be truly idle at a time of execution
of the hook
* Further improvements to out-of-band hook
* Don't trigger OOB on partially-queued requests
* Don't accept new connections during OOB
* Move tests to `TestOutOfBandServer`
Co-authored-by: Kamil Trzcinski <ayufan@ayufan.eu>
Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>