mirror of
https://github.com/nginx/nginx.git
synced 2024-12-18 21:23:36 -06:00
Upstream hash: fall back to round-robin if hash key is empty.
This commit is contained in:
parent
e0768d199d
commit
c18658e9fe
@ -178,7 +178,7 @@ ngx_http_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data)
|
||||
|
||||
ngx_http_upstream_rr_peers_rlock(hp->rrp.peers);
|
||||
|
||||
if (hp->tries > 20 || hp->rrp.peers->single) {
|
||||
if (hp->tries > 20 || hp->rrp.peers->single || hp->key.len == 0) {
|
||||
ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);
|
||||
return hp->get_rr_peer(pc, &hp->rrp);
|
||||
}
|
||||
@ -509,7 +509,7 @@ ngx_http_upstream_get_chash_peer(ngx_peer_connection_t *pc, void *data)
|
||||
|
||||
ngx_http_upstream_rr_peers_wlock(hp->rrp.peers);
|
||||
|
||||
if (hp->tries > 20 || hp->rrp.peers->single) {
|
||||
if (hp->tries > 20 || hp->rrp.peers->single || hp->key.len == 0) {
|
||||
ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);
|
||||
return hp->get_rr_peer(pc, &hp->rrp);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ ngx_stream_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data)
|
||||
|
||||
ngx_stream_upstream_rr_peers_rlock(hp->rrp.peers);
|
||||
|
||||
if (hp->tries > 20 || hp->rrp.peers->single) {
|
||||
if (hp->tries > 20 || hp->rrp.peers->single || hp->key.len == 0) {
|
||||
ngx_stream_upstream_rr_peers_unlock(hp->rrp.peers);
|
||||
return hp->get_rr_peer(pc, &hp->rrp);
|
||||
}
|
||||
@ -511,7 +511,7 @@ ngx_stream_upstream_get_chash_peer(ngx_peer_connection_t *pc, void *data)
|
||||
|
||||
ngx_stream_upstream_rr_peers_wlock(hp->rrp.peers);
|
||||
|
||||
if (hp->tries > 20 || hp->rrp.peers->single) {
|
||||
if (hp->tries > 20 || hp->rrp.peers->single || hp->key.len == 0) {
|
||||
ngx_stream_upstream_rr_peers_unlock(hp->rrp.peers);
|
||||
return hp->get_rr_peer(pc, &hp->rrp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user