rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: ghazel <ghazel@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Middleware and post-request processing
Date: Fri, 3 Jun 2011 16:23:10 -0700 (PDT)	[thread overview]
Message-ID: <2cac8438-1819-4887-bce9-9a99578539db@f31g2000pri.googlegroups.com> (raw)

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?

             reply	other threads:[~2011-06-03 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03 23:23 ghazel [this message]
2011-06-04  5:33 ` Middleware and post-request processing Eric Wong
2011-06-06 17:05 ` George
2011-06-07 17:20 ` James Tucker
2012-08-07 10:49   ` ghazel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2cac8438-1819-4887-bce9-9a99578539db@f31g2000pri.googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).