feat: add FOREMAN_KEEP_ALIVE config for worker model residency
Allow configuring how long the worker model stays resident on the Ollama
target after a request via FOREMAN_KEEP_ALIVE env var. Accepts Ollama
duration strings ("-1" forever, "0" unload, "15m", "1h", etc). Defaults
to "-1" (pin forever). The embedder warm-up is unaffected and always
uses keep_alive=-1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,9 @@ func TestLoad_Defaults(t *testing.T) {
|
||||
if cfg.PollInterval != 30*time.Second {
|
||||
t.Errorf("PollInterval = %v, want %v", cfg.PollInterval, 30*time.Second)
|
||||
}
|
||||
if cfg.KeepAlive != "-1" {
|
||||
t.Errorf("KeepAlive = %q, want %q", cfg.KeepAlive, "-1")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoad_AllEnvVars(t *testing.T) {
|
||||
@@ -42,6 +45,7 @@ func TestLoad_AllEnvVars(t *testing.T) {
|
||||
t.Setenv("FOREMAN_DB_PATH", "/data/foreman.db")
|
||||
t.Setenv("FOREMAN_POLL_INTERVAL", "1m")
|
||||
t.Setenv("FOREMAN_WEBHOOK_SECRET", "hmac-key")
|
||||
t.Setenv("FOREMAN_KEEP_ALIVE", "15m")
|
||||
|
||||
cfg, err := Load()
|
||||
if err != nil {
|
||||
@@ -72,6 +76,9 @@ func TestLoad_AllEnvVars(t *testing.T) {
|
||||
if cfg.WebhookSecret != "hmac-key" {
|
||||
t.Errorf("WebhookSecret = %q", cfg.WebhookSecret)
|
||||
}
|
||||
if cfg.KeepAlive != "15m" {
|
||||
t.Errorf("KeepAlive = %q, want %q", cfg.KeepAlive, "15m")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoad_MissingOllamaURL(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user