comparison src/http/modules/ngx_http_upstream_ip_hash_module.c @ 6108:55dc5f7eb921

Upstream: get rid of questionable micro-optimization in ip_hash. If a peer was initially skipped due to max_fails, there's no reason not to try it again if enough time has passed, and the next_upstream logic is in action. This also reduces diffs with NGINX Plus.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 16 Apr 2015 20:09:11 +0300
parents 3264b7828f72
children b6047abf5f30
comparison
equal deleted inserted replaced
6106:cb790d1b2d16 6108:55dc5f7eb921
214 214
215 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, 215 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
216 "get ip hash peer, hash: %ui %04XA", p, m); 216 "get ip hash peer, hash: %ui %04XA", p, m);
217 217
218 if (peer->down) { 218 if (peer->down) {
219 goto next_try; 219 goto next;
220 } 220 }
221 221
222 if (peer->max_fails 222 if (peer->max_fails
223 && peer->fails >= peer->max_fails 223 && peer->fails >= peer->max_fails
224 && now - peer->checked <= peer->fail_timeout) 224 && now - peer->checked <= peer->fail_timeout)
225 { 225 {
226 goto next_try; 226 goto next;
227 } 227 }
228 228
229 break; 229 break;
230
231 next_try:
232
233 iphp->rrp.tried[n] |= m;
234 pc->tries--;
235 230
236 next: 231 next:
237 232
238 if (++iphp->tries > 20) { 233 if (++iphp->tries > 20) {
239 ngx_http_upstream_rr_peers_unlock(iphp->rrp.peers); 234 ngx_http_upstream_rr_peers_unlock(iphp->rrp.peers);