Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Reactor and Client request buffering
Refactor Reactor into a more generic IO-with-timeout monitor, using Queue and SortedSet 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.
- Loading branch information
Showing
5 changed files
with
203 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Queue#close was added in Ruby 2.3. | ||
# Add a simple implementation for earlier Ruby versions. | ||
unless Queue.instance_methods.include?(:close) | ||
class ClosedQueueError < StandardError; end | ||
module Puma | ||
module QueueClose | ||
def initialize | ||
@closed = false | ||
super | ||
end | ||
def close | ||
@closed = true | ||
end | ||
def closed? | ||
@closed | ||
end | ||
def push(object) | ||
raise ClosedQueueError if @closed | ||
super | ||
end | ||
end | ||
Queue.prepend QueueClose | ||
end | ||
end |
Oops, something went wrong.