Hello everyone ! Nginx newbie here. I am actually writing a module that will handle the my http request. For this, I added a location content handler (or location directive handler) in my module. My content handler interfaces with a library which is not asynchronous. So within handler, I queue up a task to nginx thread pool. I also added a thread completion handler. The problem I am running into is that Nginx doesn't wait for my thread to finish. With in my location content handler, I queue up task and return NGX_DONE and Nginx finalizes my request while thread is running. I also tried hooking up this handler code in HTTP_CONTENT_PHASE handler instead of location content handler, but no luck so far yet.
So long story short - How can I make Nginx wait for my thread to finish before finalizing the request in HTTP_CONTENT_PHASE ? Second question - Why is it so hard to do it in Nginx :-) ?
Thanks
Newbie