Response is a stream, should emit the `end` event. Are you sure it emits
`finish`? And if there is an error it might emit `error` or `close` instead
of `end`.
On Tuesday, July 10, 2012 2:25:15 PM UTC-7, Domenic Denicola wrote:
>
> I am trying to create a mini dashboard for my server that shows number of
> "unfinished requests." (BTW if there's a better term for that let me know.)
>
> Here is what I have, but I don't think it's catching all the response
> finishes:
>
> server.server.on("request", function (request, response) {
> updateRequestCount(+1);
>
> response.on("finish", function () {
> updateRequestCount(-1);
> });
> });
>
> If I log the request count to the console, it always increases, sometimes
> going down by one, but usually going up much more than it goes down.
>
> What event can I listen to to properly count requests?
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en