Skip to content

Commit

Permalink
override max_fails
Browse files Browse the repository at this point in the history
  • Loading branch information
splitice committed Oct 15, 2024
1 parent f395c2d commit 5c291ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ Attributes:
port: Backend's listening port. (Default: 80)
max_ips: IP buffer size. Maximum number of resolved IPs to cache. (Default: 4)
interval: How many seconds to resolve domain name. (Default: 1)
max_fails: How many failures to allow before disabling
This is the same as round robin max_fails (Default: 1)
ipver: Only addresses of family IPv4 or IPv6 will be used if defined (Default: 0)
ignore_failure: Allow nginx to start even if resolution fails (1 to enable) (Default: 0)
strict: Require the DNS resolution to succeed and return addresses,
Expand Down
9 changes: 9 additions & 0 deletions src/ngx_http_upstream_jdomain_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define NGX_JDOMAIN_ARG_STR_PORT "port="
#define NGX_JDOMAIN_ARG_STR_IPVER "ipver="
#define NGX_JDOMAIN_ARG_STR_MAX_CONNS "max_conns="
#define NGX_JDOMAIN_ARG_STR_MAX_FAILS "max_fails="
#define NGX_JDOMAIN_ARG_STR_STRICT "strict"

typedef struct
Expand Down Expand Up @@ -626,6 +627,14 @@ ngx_http_upstream_jdomain(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
continue;
}

arglen = ngx_strlen(NGX_JDOMAIN_ARG_STR_MAX_FAILS);
if (ngx_strncmp(value[i].data, NGX_JDOMAIN_ARG_STR_MAX_FAILS, arglen) == 0) {
num = ngx_atoi(value[i].data + arglen, value[i].len - arglen);
server->max_fails = num;

continue;
}

goto invalid;
}

Expand Down

0 comments on commit 5c291ee

Please sign in to comment.