mirror of
https://github.com/nginx/nginx.git
synced 2026-10-24 22:57:43 -05:00
Split clients: improved calculation of range boundaries
If the last variant was given an explicit percentage to reach 100%, it did not cover hash values on the range boundary or due to accumulating rounding error. Now this corresponds to the configuration with "*".
This commit is contained in:
1 parent
cab0697310
commit
d994f5b822
2 files changed
+10
No files matched your search
@@ -182,6 +182,11 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
for (i = 0; i < ctx->parts.nelts; i++) {
|
||||
sum = part[i].percent ? sum + part[i].percent : 10000;
|
||||
|
||||
if (sum == 10000) {
|
||||
part[i].percent = 0;
|
||||
}
|
||||
|
||||
if (sum > 10000) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"percent total is greater than 100%%");
|
||||
|
||||
@@ -180,6 +180,11 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
for (i = 0; i < ctx->parts.nelts; i++) {
|
||||
sum = part[i].percent ? sum + part[i].percent : 10000;
|
||||
|
||||
if (sum == 10000) {
|
||||
part[i].percent = 0;
|
||||
}
|
||||
|
||||
if (sum > 10000) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
"percent total is greater than 100%%");
|
||||
|
||||
Reference in new issue
Block a user