Skip to content

Commit

Permalink
Simplified subrequest finalization.
Browse files Browse the repository at this point in the history
Now it looks similar to what it was before background subrequests were
introduced in 9552758a786e.
  • Loading branch information
arut committed Feb 28, 2020
1 parent 3733c6f commit 76ac67b
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions src/http/ngx_http_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
}

if (r != r->main) {
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);

if (r->buffered || r->postponed) {

Expand All @@ -2499,32 +2498,14 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
return;
}

if (r->background) {
if (!r->logged) {
if (clcf->log_subrequest) {
ngx_http_log_request(r);
}

r->logged = 1;

} else {
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
"subrequest: \"%V?%V\" logged again",
&r->uri, &r->args);
}

r->done = 1;
ngx_http_finalize_connection(r);
return;
}

pr = r->parent;

if (r == c->data) {

r->main->count--;
if (r == c->data || r->background) {

if (!r->logged) {

clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);

if (clcf->log_subrequest) {
ngx_http_log_request(r);
}
Expand All @@ -2539,6 +2520,13 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)

r->done = 1;

if (r->background) {
ngx_http_finalize_connection(r);
return;
}

r->main->count--;

if (pr->postponed && pr->postponed->request == r) {
pr->postponed = pr->postponed->next;
}
Expand Down

0 comments on commit 76ac67b

Please sign in to comment.