0.01
No commit activity in last 3 years
No release in over 3 years
Rack hook which fires after the socket to the client is closed.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Rack After Reply

A hook for Rack apps which fires after the response has been sent, and the socket to the client has been closed.

This is the ideal time to perform delayable, non-backgroundable tasks, such as garbage collection, stats gathering, flushing logs, etc. without affecting response times at all.

Usage

Simply add your callbacks to env['rack_after_reply.callbacks'].

use Rack::ContentLength
use Rack::ContentType, 'text/plain'
run lambda { |env|
  env['rack_after_reply.callbacks'] << lambda { ... }
  [200, {}, ['hi']]
}

Support

Rack After Request works with these web servers:

To request support for other web servers, open a ticket or submit a patch.

Contributing

  • Bug reports
  • Source
  • Patches: Fork on Github, send pull request.
    • Ensure patch includes tests.
    • Leave the version alone, or bump it in a separate commit.

Copyright

Copyright (c) George Ogata. See LICENSE for details.