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

5 commits

Author SHA1 Message Date
Will Jordan
ff17194228
Refactor drain on shutdown (#2600)
* Refactor test_puma_server#server_run for option arguments

* Refactor drain_on_shutdown into main server accept loop
Also add test coverage for drain_on_shutdown option.
2021-04-30 17:22:59 -05:00
MSP-Greg
0e804b21bf
queue_close.rb - fix 'warning: instance variable @closed not initialized' on Ruby 2.2 2020-10-25 17:07:43 -05:00
MSP-Greg
c17a4a5e6a
queue_close.rb - refactor loading, move comment for docs (#2447) 2020-10-25 13:59:40 -06:00
Will Jordan
761fbafb8d
Test adding connection to Reactor after shutdown [changelog skip] (#2418)
* Test adding connection to Reactor after shutdown
Modifies `TestPumaServer#shutdown_requests` to pause `Reactor#add` until after
shutdown begins, to ensure requests are handled correctly for this edge case.
Adds unit-test coverage for the fix introduced in #2377 and updated in #2279.

* Fix Queue#close implementation for Ruby 2.2
Allow `ClosedQueueError` to be raised when `Queue#<<` is called.

* Pass `@block` directly instead of `@block.method(:call)`
2020-10-07 19:51:59 -06:00
Will Jordan
a76d3905d8
Reactor refactor (#2279)
* Refactor Reactor and Client request buffering
Refactor Reactor into a more generic IO-with-timeout monitor,
using a Queue to simplify the implementation.
Move request-buffering logic into Server#reactor_wakeup.
Fixes bug in managing timeouts on clients.
Move, update and rewrite documentation to match updated class structure.

* Fix a few concurrency bugs
- In `Reactor#shutdown`, `@selector` can be closed before the call to `#wakeup`, so catch/ignore the `IOError` that may be thrown.
- `Reactor#wakeup!` can delete elements from the `@timeouts` array so calling it from an `#each` block can cause the array iteration to miss elements. Call @block directly instead.
- Change `Reactor#add` to return `false` if the reactor is already shut down instead of invoking the block immediately, so a client-request currently being processed can continue, rather than re-adding to the thread-pool (which may already be shutting down and unable to accept new work).

Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>
2020-10-06 07:22:53 -06:00