Suspending request

Michael Talyansky michael.talyansky at gmail.com
Wed May 25 02:26:05 UTC 2016


Hi,

 

I am trying to design a non-proxying module that would do the following:

 

In ACCESS phase, signal to nginx event loop that this request needs to be suspended, while the module communicates with another service running on the same machine. This service, after some delay, will return a verdict that will determine whether suspended request should be resumed and proceed normally to the next phase, or terminated with some return code and body.

 

I understand that returning NGX_DONE from a phase handler is a recommended way, and that this handler will get called again after some trigger. As stated in nginxguts blog: “Now the list of events is determined by the list of events that trigger invocation of ngx_http_core_run_phases. So far I know only 3 of and you have already mentioned them. In the future there might be more (e.g. an event that signals that other worker has finished fetching some resource) and nothing stops you from implementing your own”. So, how do I go about implementing my own event that will trigger re-calling of the phase handler? Are there examples of modules that do similar things?

 

Thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160524/178e82aa/attachment.html>


More information about the nginx-devel mailing list