fix: egress cache TTL independent from fetcher cache (24h default)
Egress probe results (IP/country/region/city/isp) were cached using the fetcher's cache_ttl (300s / 5min). After 5 minutes the cache expired and the node list showed empty Egress IP/Country/Region fields again. Add a dedicated egress_cache_ttl config (default 24h) so egress data persists long enough to be useful when re-expanding the node list.
This commit is contained in:
@@ -66,9 +66,9 @@ func (d *Deps) HandleEgressInfo(c fiber.Ctx) error {
|
||||
}
|
||||
info["cached"] = false
|
||||
if data, err := json.Marshal(info); err == nil {
|
||||
ttl := int(d.Cfg.Fetcher.CacheTTL.Seconds())
|
||||
ttl := int(d.Cfg.Fetcher.EgressCacheTTL.Seconds())
|
||||
if ttl <= 0 {
|
||||
ttl = 300
|
||||
ttl = 86400 // 24h default
|
||||
}
|
||||
d.CacheRepo.SafePut(cacheKey, string(data), nil, ttl)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user