feat: runtime bootstrap snapshot cache with backoff
This commit is contained in:
1 parent
08f60a14d1
commit
aa6bb23e24
19 files changed
+1400
-384
No files matched your search
@@ -10,13 +10,17 @@ import (
|
||||
// Config is the process configuration.
|
||||
type Config struct {
|
||||
Addr string
|
||||
DataDir string
|
||||
FastAPIURL string
|
||||
ControlUser string
|
||||
ControlPass string
|
||||
ControlToken string
|
||||
Heartbeat time.Duration
|
||||
MLTimeout time.Duration
|
||||
|
||||
// RefreshInterval is how often a healthy /bootstrap snapshot is refreshed.
|
||||
RefreshInterval time.Duration
|
||||
// BootstrapTimeout bounds one /bootstrap request.
|
||||
BootstrapTimeout time.Duration
|
||||
}
|
||||
|
||||
// Load reads configuration from env with local-development defaults.
|
||||
@@ -26,14 +30,15 @@ type Config struct {
|
||||
func Load() Config {
|
||||
port := getenv("PORT", "8080")
|
||||
return Config{
|
||||
Addr: ":" + port,
|
||||
DataDir: getenv("DATA_DIR", "testdata/data"),
|
||||
FastAPIURL: getenv("FASTAPI_URL", "http://localhost:8000"),
|
||||
ControlUser: os.Getenv("CONTROL_USER"),
|
||||
ControlPass: os.Getenv("CONTROL_PASS"),
|
||||
ControlToken: os.Getenv("CONTROL_TOKEN"),
|
||||
Heartbeat: durationEnv("SSE_HEARTBEAT", 15*time.Second),
|
||||
MLTimeout: durationEnv("ML_TIMEOUT", 1500*time.Millisecond),
|
||||
Addr: ":" + port,
|
||||
FastAPIURL: getenv("FASTAPI_URL", "http://localhost:8000"),
|
||||
ControlUser: os.Getenv("CONTROL_USER"),
|
||||
ControlPass: os.Getenv("CONTROL_PASS"),
|
||||
ControlToken: os.Getenv("CONTROL_TOKEN"),
|
||||
Heartbeat: durationEnv("SSE_HEARTBEAT", 15*time.Second),
|
||||
MLTimeout: durationEnv("ML_TIMEOUT", 1500*time.Millisecond),
|
||||
RefreshInterval: durationEnv("BOOTSTRAP_REFRESH", 60*time.Second),
|
||||
BootstrapTimeout: durationEnv("BOOTSTRAP_TIMEOUT", 20*time.Second),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user