diff options
author | Eric Wong <e@80x24.org> | 2015-04-03 00:13:28 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-04-03 01:52:08 +0000 |
commit | 78f23338ef08fe98e7d90d35ba1f8356de51e3d4 (patch) | |
tree | 787908fa9861c9c9f6278d1f1bfcfb11db225181 /lib/yahns/wbuf.rb | |
parent | 44e533af884bcebd38a319287f359cbfbc161b55 (diff) | |
download | yahns-78f23338ef08fe98e7d90d35ba1f8356de51e3d4.tar.gz |
This allows our reverse proxy to avoid having an innefficient 1:1 relationship between threads and upstream connections, reducing memory usage when there are many upstream connections (possibly to multiple backend machines).
Diffstat (limited to 'lib/yahns/wbuf.rb')
-rw-r--r-- | lib/yahns/wbuf.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/yahns/wbuf.rb b/lib/yahns/wbuf.rb index fa39b9b..42776cf 100644 --- a/lib/yahns/wbuf.rb +++ b/lib/yahns/wbuf.rb @@ -30,6 +30,7 @@ require_relative 'wbuf_common' class Yahns::Wbuf # :nodoc: include Yahns::WbufCommon attr_reader :busy + attr_reader :wbuf_persist def initialize(body, persist, tmpdir, busy) @tmpio = nil @@ -71,7 +72,7 @@ class Yahns::Wbuf # :nodoc: # we're all caught up, try to prevent dirty data from getting flushed # to disk if we can help it. - @tmpio = @tmpio.close + wbuf_abort @sf_offset = 0 @busy = false nil @@ -79,7 +80,11 @@ class Yahns::Wbuf # :nodoc: # called by last wbuf_flush def wbuf_close(client) - @tmpio = @tmpio.close if @tmpio + wbuf_abort wbuf_close_common(client) end + + def wbuf_abort + @tmpio = @tmpio.close if @tmpio + end end |