rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Middleware and post-request processing
@ 2011-06-03 23:23 ghazel
  2011-06-04  5:33 ` Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ghazel @ 2011-06-03 23:23 UTC (permalink / raw)
  To: Rack Development

It seems to me that Rack is in need of a new post-response stage of
processing. This stage would occur after the response is fully written
and the client is unblocked, and before the next request is processed.

Similar to what OobGC ( http://bogomips.org/unicorn.git/tree/lib/unicorn/oob_gc.rb#n59
) accomplishes, it is sometimes useful to perform additional
operations after the response is written without blocking the client.
For example, the Oink middleware logs statistics about the request,
but blocks the response since it has no ability not to: (
https://github.com/noahd1/oink/blob/4158d71bc9150f011072b2c6eefe73c720a78d46/lib/oink/middleware.rb#L16
). This processing takes time, and needlessly delays the response.

This proposal would entail something like a single function which is
called on each middleware after the response is written to the client
and the socket is closed (depending on the server implementation). For
servers which have no ability to not block the client or delay further
requests the function should still be called, and the impact would be
similar to the behavior today.

Thoughts?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-07 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03 23:23 Middleware and post-request processing ghazel
2011-06-04  5:33 ` Eric Wong
2011-06-06 17:05 ` George
2011-06-07 17:20 ` James Tucker
2012-08-07 10:49   ` ghazel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).