Skip to content

oggy/rack_after_reply

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Rack hook which fires after the socket to the client is closed.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages