Skip to content

Commit

Permalink
Little refactoring in prefix creation, and doc for cluster_profile
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Jul 5, 2016
1 parent 05c071d commit 87ea8f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@
# attempting to connect to it.
# Recommended to be at least `60`.

#cluster_profile = wan # The timing profile for infracluster pings
# and timeouts. If a `lan` or `local` profile
# is used over the Internet, a high rate of
# failures is risked as the timing contraints
# would be too tight.
# Accepted values are `local`, `lan` and `wan`.

#------------------------------------------------------------------------------
# DNS RESOLVER
#------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions kong/cmd/utils/prefix_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ local function gather_system_infos(compile_env)
local ulimit, err = get_ulimit()
if not ulimit then return nil, err end
infos.worker_rlimit = ulimit
infos.worker_connections = ulimit > 16384 and 16384 or ulimit
infos.worker_connections = math.min(16384, ulimit)

return infos
end
Expand Down Expand Up @@ -116,7 +116,7 @@ local function compile_conf(kong_config, conf_template, env_t)
if kong_config.anonymous_reports then
-- If there is no internet connection, disable this feature
if socket.dns.toip(constants.SYSLOG.ADDRESS) then
compile_env["syslog_reports"] = string.format("error_log syslog:server=%s:%d error;",
compile_env["syslog_reports"] = fmt("error_log syslog:server=%s:%d error;",
constants.SYSLOG.ADDRESS,
constants.SYSLOG.PORT)
end
Expand Down Expand Up @@ -170,7 +170,7 @@ local function prepare_prefix(kong_config)
end

log.verbose("saving Serf shell script handler in %s", kong_config.serf_event)
local script = string.format(script_template, "127.0.0.1", kong_config.admin_port)
local script = fmt(script_template, "127.0.0.1", kong_config.admin_port)
pl_file.write(kong_config.serf_event, script)
local ok, _, _, stderr = pl_utils.executeex("chmod +x "..kong_config.serf_event)
if not ok then return nil, stderr end
Expand All @@ -193,7 +193,7 @@ local function prepare_prefix(kong_config)
local ulimit, err = get_ulimit()
if not ulimit then return nil, err end
if ulimit < 4096 then
log.warn(string.format("ulimit is currently set to \"%d\". For better performance set it to at least \"4096\" using \"ulimit -n\"", ulimit))
log.warn(fmt([[ulimit is currently set to "%d". For better performance set it to at least "4096" using "ulimit -n"]], ulimit))
end

-- write NGINX conf
Expand Down

0 comments on commit 87ea8f5

Please sign in to comment.