comparison src/stream/ngx_stream_upstream.c @ 7397:860d3907da1c

Upstream: revised upstream response time variables. Variables now do not depend on presence of the HTTP status code in response. If the corresponding event occurred, variables contain time between request creation and the event, and "-" otherwise. Previously, intermediate value of the $upstream_response_time variable held unix timestamp.
author Vladimir Homutov <vl@nginx.com>
date Wed, 21 Nov 2018 13:40:40 +0300
parents 2a288909abc6
children
comparison
equal deleted inserted replaced
7396:e8bdd322d7a6 7397:860d3907da1c
265 state = s->upstream_states->elts; 265 state = s->upstream_states->elts;
266 266
267 for ( ;; ) { 267 for ( ;; ) {
268 268
269 if (data == 1) { 269 if (data == 1) {
270 if (state[i].first_byte_time == (ngx_msec_t) -1) {
271 *p++ = '-';
272 goto next;
273 }
274
275 ms = state[i].first_byte_time; 270 ms = state[i].first_byte_time;
276 271
277 } else if (data == 2 && state[i].connect_time != (ngx_msec_t) -1) { 272 } else if (data == 2) {
278 ms = state[i].connect_time; 273 ms = state[i].connect_time;
279 274
280 } else { 275 } else {
281 ms = state[i].response_time; 276 ms = state[i].response_time;
282 } 277 }
283 278
284 ms = ngx_max(ms, 0); 279 if (ms != -1) {
285 p = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000); 280 ms = ngx_max(ms, 0);
286 281 p = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000);
287 next: 282
283 } else {
284 *p++ = '-';
285 }
288 286
289 if (++i == s->upstream_states->nelts) { 287 if (++i == s->upstream_states->nelts) {
290 break; 288 break;
291 } 289 }
292 290