pedestal

2020-11-16T18:47:06.157500Z

am i correct in thinking that no :leave function will ever be called if there is a handler anywhere in the interceptor stack?

2020-11-16T18:49:11.158800Z

or just those whose sister :enter functions have not been invoked?

2020-11-16T18:50:43.159100Z

or just those whose interceptor is placed after the handler?

2020-11-16T18:57:46.160900Z

i was reading something in the documentation about this just a few days ago, but i can't seem to find it. what i see now says: the handler must be the last interceptor. i assume other interceptors' :leave functions will be invoked, even with a handler in the final position, even if they have no corresponding :enter function, because not doing so would severely limit the use of handlers, ever.

Louis Kottmann 2020-11-16T22:36:51.162Z

every time an :enter interceptor is called, its corresponding :leave is added to the stack of things to call when unwinding

Louis Kottmann 2020-11-16T22:37:25.162600Z

if your interceptor only has a :leave fn defined, if must be passed throuh on the way in to be pushed to the stack

Louis Kottmann 2020-11-16T22:38:33.163500Z

handlers are meant to be the last thing in the chain, and you can tell because they do not get the full context (just the :request)

Louis Kottmann 2020-11-16T22:38:40.163700Z

i.e: they cannot enqueue anything

Louis Kottmann 2020-11-16T22:39:06.164100Z

they do not, however, prevent :leave fns to be called when unwinding

2020-11-16T22:59:49.164300Z

thanks @lkottmann!