Optimization for bracketHandler: skip acquire and release actions when they're not needed
kaol opened this issue · comments
I think bracketHandler
could be more intelligent with regard to snaplets' behavior. Using it on Heist (for example) makes the acquire and release actions run for url patterns that it has no templates for and as such would never accept. It would never invoke any user splice code in such a case. Any reasonable pair of acquire and release actions should be a no op in such a case, besides wasting some resources. It would be a nice optimization for Snap for it to skip using them in such a case.
I'm not quite sure how to go about implementing something like this. A Handler, as a monad, is opaque to whether it would reject a particular url and by the time it returns empty the acquire action has been called already.