diff options
author | Eric Wong <e@80x24.org> | 2019-05-26 22:15:44 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-26 22:27:35 +0000 |
commit | 07b64755b203d9c99a59ae69e3155103d4cfefc5 (patch) | |
tree | 585cc0b26b7b7bb8d2e5cb3dfa58a455b2537ea1 /lib/unicorn/worker.rb | |
parent | 2ea6af4ed1ce5f3a34bdfd32b9e54a67fabcff26 (diff) | |
download | unicorn-no-kgio-wip.tar.gz |
It's fairly easy given unicorn was designed with synchronous I/O in mind. The overhead of backtraces from EOFError on readpartial should be rare given our requirement to only accept requests from fast, reliable clients on LAN (e.g. nginx or yet-another-horribly-named-server).
Diffstat (limited to 'lib/unicorn/worker.rb')
-rw-r--r-- | lib/unicorn/worker.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/unicorn/worker.rb b/lib/unicorn/worker.rb index 5ddf379..ad5814c 100644 --- a/lib/unicorn/worker.rb +++ b/lib/unicorn/worker.rb @@ -65,7 +65,7 @@ class Unicorn::Worker end # writing and reading 4 bytes on a pipe is atomic on all POSIX platforms # Do not care in the odd case the buffer is full, here. - @master.kgio_trywrite([signum].pack('l')) + @master.write_nonblock([signum].pack('l'), exception: false) rescue Errno::EPIPE # worker will be reaped soon end @@ -73,7 +73,7 @@ class Unicorn::Worker # this only runs when the Rack app.call is not running # act like a listener def kgio_tryaccept # :nodoc: - case buf = @to_io.kgio_tryread(4) + case buf = @to_io.read_nonblock(4, exception: false) when String # unpack the buffer and trigger the signal handler signum = buf.unpack('l') |