From b954343d734a4798b14d886d0d851ff9e526117d Mon Sep 17 00:00:00 2001 From: S7evinK Date: Fri, 16 Jul 2021 20:42:53 +0200 Subject: [PATCH] Fix DNS CacheLifetime (#1926) Signed-off-by: Till Faelligen --- dendrite-config.yaml | 2 +- setup/base.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dendrite-config.yaml b/dendrite-config.yaml index 0ea584aa9..31b830663 100644 --- a/dendrite-config.yaml +++ b/dendrite-config.yaml @@ -112,7 +112,7 @@ global: # Maximum number of entries to hold in the DNS cache, and # for how long those items should be considered valid in seconds. cache_size: 256 - cache_lifetime: 300 + cache_lifetime: "5m" # 5minutes; see https://pkg.go.dev/time@master#ParseDuration for more # Configuration for the Appservice API. app_service_api: diff --git a/setup/base.go b/setup/base.go index 7b691608d..1a52d1c26 100644 --- a/setup/base.go +++ b/setup/base.go @@ -139,15 +139,14 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, useHTTPAPIs boo var dnsCache *gomatrixserverlib.DNSCache if cfg.Global.DNSCache.Enabled { - lifetime := time.Second * cfg.Global.DNSCache.CacheLifetime dnsCache = gomatrixserverlib.NewDNSCache( cfg.Global.DNSCache.CacheSize, - lifetime, + cfg.Global.DNSCache.CacheLifetime, ) logrus.Infof( "DNS cache enabled (size %d, lifetime %s)", cfg.Global.DNSCache.CacheSize, - lifetime, + cfg.Global.DNSCache.CacheLifetime, ) }