Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmd): do not override kong.conf if --db-timeout is not passed #12761

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/kong/fix-cli-db-timeout-overrides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
Fixed an issue where the `pg_timeout` was overridden to `60s` even if `--db-timeout`
was not explicitly passed in CLI arguments.
type: bugfix
scope: CLI Command
6 changes: 3 additions & 3 deletions kong/cmd/migrations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Options:
-f,--force Run migrations even if database reports
as already executed.

--db-timeout (default 60) Timeout, in seconds, for all database
--db-timeout (optional number) Timeout, in seconds, for all database
operations.


Expand Down Expand Up @@ -77,7 +77,7 @@ end


local function execute(args)
args.db_timeout = args.db_timeout * 1000
args.db_timeout = args.db_timeout and (args.db_timeout * 1000) or nil
args.lock_timeout = args.lock_timeout

if args.quiet then
Expand All @@ -90,7 +90,7 @@ local function execute(args)

package.path = conf.lua_package_path .. ";" .. package.path

conf.pg_timeout = args.db_timeout -- connect + send + read
conf.pg_timeout = args.db_timeout or conf.pg_timeout -- connect + send + read
ms2008 marked this conversation as resolved.
Show resolved Hide resolved

assert(prefix_handler.prepare_prefix(conf, args.nginx_conf, true))

Expand Down
2 changes: 1 addition & 1 deletion kong/cmd/restart.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Options:
-p,--prefix (optional string) prefix at which Kong should be running
--nginx-conf (optional string) custom Nginx configuration template
--run-migrations (optional boolean) optionally run migrations on the DB
--db-timeout (default 60)
--db-timeout (optional number)
--lock-timeout (default 60)
--nginx-conf-flags (optional string) flags that can be used to control
how Nginx configuration templates are rendered
Expand Down
6 changes: 3 additions & 3 deletions kong/cmd/start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ local function cleanup_dangling_unix_sockets(prefix)
end

local function execute(args)
args.db_timeout = args.db_timeout * 1000
args.db_timeout = args.db_timeout and (args.db_timeout * 1000) or nil
args.lock_timeout = args.lock_timeout

local conf = assert(conf_loader(args.conf, {
prefix = args.prefix
}, { starting = true }))

conf.pg_timeout = args.db_timeout -- connect + send + read
conf.pg_timeout = args.db_timeout or conf.pg_timeout -- connect + send + read

assert(not kill.is_running(conf.nginx_pid),
"Kong is already running in " .. conf.prefix)
Expand Down Expand Up @@ -126,7 +126,7 @@ Options:

--run-migrations (optional boolean) Run migrations before starting.

--db-timeout (default 60) Timeout, in seconds, for all database
--db-timeout (optional number) Timeout, in seconds, for all database
operations.

--lock-timeout (default 60) When --run-migrations is enabled, timeout,
Expand Down
Loading