From fc6520d722d939230b8f9652dfc0a3040622d3df Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Thu, 19 Oct 2017 17:37:26 +0300 Subject: Keep application worker until response for all requests received. --- src/nxt_router.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nxt_router.c b/src/nxt_router.c index 155d1dff..1a9ec32c 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -2644,6 +2644,7 @@ nxt_router_app_port_release(nxt_task_t *task, nxt_port_t *port, { int use_delta, ra_use_delta; nxt_app_t *app; + nxt_bool_t send_quit; nxt_queue_link_t *lnk; nxt_req_app_link_t *ra; @@ -2688,6 +2689,8 @@ nxt_router_app_port_release(nxt_task_t *task, nxt_port_t *port, ra_use_delta = 0; } + send_quit = app->live == 0 && port->app_requests == port->app_responses; + nxt_thread_mutex_unlock(&app->mutex); if (ra != NULL) { @@ -2706,7 +2709,7 @@ nxt_router_app_port_release(nxt_task_t *task, nxt_port_t *port, goto adjust_use; } - if (app->live == 0) { + if (send_quit) { nxt_debug(task, "app '%V' %p is not alive, send QUIT to port", &app->name, app); -- cgit