Skip to content

Commit

Permalink
chore(db): only enable posgres cleanup timer on nodes that have admin…
Browse files Browse the repository at this point in the history
… listeners (#10405)

### Summary

PR #10389 and #10331 pursued different ways to improve our situation with cleanup timers.

This PR makes it so that it only happens on nodes that have admin listeners. Fairly simple
but may already cover the majority of problem space.
  • Loading branch information
bungle authored Mar 1, 2023
1 parent dbe8d94 commit 5527939
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
- Bumped lua-resty-session from 4.0.2 to 4.0.3
[#10338](https://github.com/Kong/kong/pull/10338)

### Changed

#### Core

- Postgres TTL cleanup timer will now only run on traditional and control plane nodes that have enabled the Admin API.

## 3.2.0

### Breaking Changes
Expand Down
3 changes: 1 addition & 2 deletions kong/db/strategies/postgres/connector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ end


function _mt:init_worker(strategies)
if ngx.worker.id() == 0 then

if ngx.worker.id() == 0 and #kong.configuration.admin_listeners > 0 then
local table_names = get_names_of_tables_with_ttl(strategies)
local ttl_escaped = self:escape_identifier("ttl")
local expire_at_escaped = self:escape_identifier("expire_at")
Expand Down

1 comment on commit 5527939

@khcp-gha-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:55279394c96b1093383eec432ca7d1342c599bbf
Artifacts available https://github.com/Kong/kong/actions/runs/4303457343

Please sign in to comment.