orthecreedence / wookie

Asynchronous HTTP server in common lisp
http://wookie.lyonbros.com/
MIT License
189 stars 19 forks source link

Do hooks run one after the other or in parallel? (pre-fast-http) (current ql) #69

Open nightshade427 opened 9 years ago

nightshade427 commented 9 years ago

Do hooks run one after the other or in parallel (not waitiing for the other to finish its future first)? I have a few pre-route hooks that I run and when one sends a response back to the client it calls (signal-error) so it should bypass the rest of the hooks but it still seems to call the others?

example: There are two hooks, prefetch and auth (registerted in that order). When prefetch succeededs I dont want it to call auth at all, but while prefetches makes an async request, it looks like wookie continues and calls auth anyways while prefetch is waiting or its aync call to come back. So auth fails and kills the whole request. When what I want is for auth hook to only be called once prefetch returns and completes its future.

(I could put them in the same hook can call auth once prefetch is done, but I really wanted them to be handled as two distinct hooks that two devs could work on them individually)

orthecreedence commented 9 years ago

Wow, sorry, a month late. Yes the hooks are run in parallel. I'm not married to this though, and it could actually be made configurable. Obviously the hack for now (as you mentioned) is to just have one hook and call two separate functions from it. I like the idea of sequentially running hooks though. I'll try to fit this in soon.

nightshade427 commented 9 years ago

Awesome :)