Fork me on GitHub
#pedestal
<
2020-11-16
>
Michael Stokley18:11:06

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

Michael Stokley18:11:11

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

Michael Stokley18:11:43

or just those whose interceptor is placed after the handler?

Michael Stokley18:11:46

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 Kottmann22:11:51

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

Louis Kottmann22:11:25

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 Kottmann22:11:33

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 Kottmann22:11:40

i.e: they cannot enqueue anything

Louis Kottmann22:11:06

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