no need to support custom handler
defunctzombie opened this issue · 6 comments
Why not just always call next(err) instead of supporting the custom handler. That way the middleware becomes simpler since you just create a domain object and capture any errors from it. You let the normal connect stack handle error propagation.
I did a quick edit to show what I was describing:
https://github.com/shtylman/connect-domain/blob/master/lib/connect-domain.js
It's just old code support. Removed now.
About your edit:
res.on('close', reqDomain.dispose.bind(reqDomain));
works slower than
res.on('close', function () {
reqDomain.dispose();
});
On my environmet benchmarks shows ~2650 rps with function
vs ~2350 rps with bind
.
cool! Also, not sure why you have the whole thing in a closure, but that could go as well.
Yea, I figured the bind might be a bit slower.
Closure is a jsLint recommendation to force StrictMode. But i'm unsure about is it realy needed here.
I would say not needed :) It isn't really the idiosyncratic way to write modules in node.
Ok :) Removed.