mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-08 21:58:24 +02:00
feat(extension-health): lengthen cache TTL and honor per-check minimum
Raise default extension health cache to 10 minutes with a 1-minute floor and a shorter TTL for unknown status. Mirror the TTL rules in the Go backend and stop force-refreshing health checks from the download service picker on every open.
This commit is contained in:
@@ -15,8 +15,9 @@ import (
|
||||
const (
|
||||
extensionHealthDefaultTimeout = 4 * time.Second
|
||||
extensionHealthMaxBodyBytes = 64 * 1024
|
||||
extensionHealthDefaultCache = 60 * time.Second
|
||||
extensionHealthUnknownCache = 20 * time.Second
|
||||
extensionHealthDefaultCache = 10 * time.Minute
|
||||
extensionHealthMinCache = 60 * time.Second
|
||||
extensionHealthUnknownCache = 2 * time.Minute
|
||||
)
|
||||
|
||||
type ExtensionHealthResult struct {
|
||||
@@ -166,6 +167,9 @@ func extensionHealthCacheTTL(checks []ExtensionHealthCheck) time.Duration {
|
||||
continue
|
||||
}
|
||||
checkTTL := time.Duration(check.CacheTTLSeconds) * time.Second
|
||||
if checkTTL < extensionHealthMinCache {
|
||||
checkTTL = extensionHealthMinCache
|
||||
}
|
||||
if checkTTL < ttl {
|
||||
ttl = checkTTL
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user