Skip to content

Commit

Permalink
feat(*) add a new 'db_resurrect_ttl' config option
Browse files Browse the repository at this point in the history
This option is based on
thibaultcha/lua-resty-mlcache#52

Documentation for its behaviour can be read in the description test
included in kong.conf.default.
  • Loading branch information
thibaultcha committed Jun 29, 2018
1 parent c9cb761 commit c932dc6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,13 @@
# If set to 0 (default), such cached entities
# or misses never expire.

#db_resurrect_ttl = 30 # Time (in seconds) for which stale entities
# from the datastore should be resurrected for
# when they cannot be refreshed (e.g., the
# datastore is unreachable). When this TTL
# expires, a new attempt to refresh the stale
# entities will be made.

#------------------------------------------------------------------------------
# DNS RESOLVER
#------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions kong/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function _M.new(opts)
lru_size = LRU_SIZE,
ttl = max(opts.ttl or 3600, 0),
neg_ttl = max(opts.neg_ttl or 300, 0),
resurrect_ttl = opts.resurrect_ttl or 30,
resty_lock_opts = opts.resty_lock_opts,
ipc = {
register_listeners = function(events)
Expand Down
1 change: 1 addition & 0 deletions kong/conf_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ local CONF_INFERENCES = {
db_update_frequency = { typ = "number" },
db_update_propagation = { typ = "number" },
db_cache_ttl = { typ = "number" },
db_resurrect_ttl = { typ = "number" },
nginx_user = {typ = "string"},
nginx_worker_processes = {typ = "string"},
upstream_keepalive = {typ = "number"},
Expand Down
1 change: 1 addition & 0 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ function Kong.init_worker()
propagation_delay = kong.configuration.db_update_propagation,
ttl = kong.configuration.db_cache_ttl,
neg_ttl = kong.configuration.db_cache_ttl,
resurrect_ttl = kong.configuration.resurrect_ttl,
resty_lock_opts = {
exptime = 10,
timeout = 5,
Expand Down
1 change: 1 addition & 0 deletions kong/templates/kong_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ cassandra_schema_consensus_timeout = 10000
db_update_frequency = 5
db_update_propagation = 0
db_cache_ttl = 0
db_resurrect_ttl = 30
dns_resolver = NONE
dns_hostsfile = /etc/hosts
Expand Down

0 comments on commit c932dc6

Please sign in to comment.