diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-02-05 20:19:15 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-02-09 19:50:49 -0800 |
commit | a105f96edd9bc842170c6272b0d37b8891152824 (patch) | |
tree | f8665116ba0c8d87b72e7b4d8ad35f180ebad8f2 /lib/unicorn.rb | |
parent | dad8471b4cc9412b0d56e68d0c143b356998c2a0 (diff) | |
download | unicorn-a105f96edd9bc842170c6272b0d37b8891152824.tar.gz |
This will help prevent TMPDIR from becoming bloated when handling thousands of large uploads a day. This is a problem in many UNIX filesystems (including ext3): names of entries never expire even after files are gone and the only way to clear it is to get rid of the directory itself.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 1cc814a..b91950f 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -120,11 +120,9 @@ module Unicorn params[Const::REMOTE_ADDR] = client.peeraddr.last # Select handlers that want more detailed request notification - request = HttpRequest.new(params, client, logger) - - # in the case of large file uploads the user could close the socket, so skip those requests - break if request.body == nil # nil signals from HttpRequest::initialize that the request was aborted - app_response = @app.call(request.env) + request = $http_request ||= HttpRequest.new(logger) + env = request.consume(params, client) or break + app_response = @app.call(env) HttpResponse.send(client, app_response) break #done else @@ -157,7 +155,7 @@ module Unicorn logger.error "Client error: #{e.inspect}" logger.error e.backtrace.join("\n") end - request.body.close! if request and request.body.class == Tempfile + request.reset! if request end end |