From 6f092ddc126201c0e0a916c7856c54b49cf3cf83 Mon Sep 17 00:00:00 2001 From: mram Date: Mon, 21 Sep 2026 21:10:21 +0200 Subject: [PATCH] Default GAME_POLL_INTERVAL to 15s: nvidia-smi polls keep the GPU awake --- README.md | 4 ++-- SPEC.md | 4 ++-- internal/config/config.go | 2 +- internal/config/config_test.go | 4 ++-- internal/config/sample.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 19fae8c..14886f1 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ override file values. Invalid values fail at startup. | `GAME_PROCS` | _(empty = disabled)_ | Process names (comma-separated); while any runs, the GPU counts as held: requests wait, Ollama unloads, managed ComfyUI stops | | `GPU_FOREIGN_VRAM_MB` | `0` (disabled) | Also treat the GPU as held when a non-ignored process uses more VRAM than this (needs nvidia-smi) | | `GPU_IGNORE_PROCS` | `ollama,ollama app,ollama_llama_server,python,pythonw` | Process names never counted as foreign GPU users | -| `GAME_POLL_INTERVAL` | `5s` | How often game/VRAM detection runs | +| `GAME_POLL_INTERVAL` | `15s` | How often game/VRAM detection runs (don't go below ~10s — nvidia-smi polls keep the GPU awake) | | `LOGLEVEL` | `warn` | `info` logs every request (colored arrows in text mode), `debug` adds lock transitions. `LOG_LEVEL` works as an alias | | `LOG_FORMAT` | `text` | `json` for structured JSON logs | | `LOG_FILE` | _(empty)_ | Append logs to this file instead of stderr | @@ -130,7 +130,7 @@ Want to game on the same GPU without Ollama/ComfyUI squatting on the VRAM? gpu-turnstile can watch for foreign GPU holders and, while one is active, make LLM/image requests wait (or 503, per `LLM_BUSY_MODE`), unload Ollama's models and stop the managed ComfyUI so the game gets the memory. Two -detection paths, each optional, polled every `GAME_POLL_INTERVAL` (5s): +detection paths, each optional, polled every `GAME_POLL_INTERVAL` (15s): ``` GAME_PROCS=cyberpunk2077.exe,bg3.exe # the reliable way on Windows diff --git a/SPEC.md b/SPEC.md index 40abc2b..4a050a9 100644 --- a/SPEC.md +++ b/SPEC.md @@ -159,7 +159,7 @@ process instead of expecting an always-on server: Games and other foreign GPU users sit outside the URL-based consumer model — nothing proxies through gpu-turnstile for them. Two independent detection -paths, polled every `GAME_POLL_INTERVAL` (default 5 s); either one being +paths, polled every `GAME_POLL_INTERVAL` (default 15 s); either one being configured enables the feature: - **Process watch list** (`GAME_PROCS`, comma-separated, case-insensitive, @@ -218,7 +218,7 @@ override file values. A missing file is fine; a malformed one is fatal. | `GAME_PROCS` | _(empty = disabled)_ | comma-separated process names (case-insensitive, `.exe` optional); while any runs, the GPU counts as held by it: requests wait, Ollama unloads, the managed ComfyUI stops | | `GPU_FOREIGN_VRAM_MB` | `0` (disabled) | also treat the GPU as held when a process not in `GPU_IGNORE_PROCS` uses more VRAM than this; needs nvidia-smi | | `GPU_IGNORE_PROCS` | `ollama,ollama app,ollama_llama_server,python,pythonw` | process names never counted as foreign GPU users | -| `GAME_POLL_INTERVAL` | `5s` | how often game/VRAM detection runs | +| `GAME_POLL_INTERVAL` | `15s` | how often game/VRAM detection runs (nvidia-smi polls keep the GPU awake; don't go below ~10s) | | `LOGLEVEL` | `warn` | `info` logs every request (colored arrows in text mode), `debug` adds lock transitions. `LOG_LEVEL` is accepted as an alias | | `LOG_FORMAT` | `text` | `json` for structured JSON logs | | `LOG_FILE` | `` | append logs to this file instead of stderr (useful as a service) | diff --git a/internal/config/config.go b/internal/config/config.go index dbb498e..f6f60fe 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -116,7 +116,7 @@ func Defaults() Config { // ComfyUI runs under python; excluding it (and Ollama) by name keeps // our own consumers from tripping the foreign-VRAM check. GPUIgnoreProcs: []string{"ollama", "ollama app", "ollama_llama_server", "python", "pythonw"}, - GamePollInterval: 5 * time.Second, + GamePollInterval: 15 * time.Second, LogLevel: slog.LevelWarn, } diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 5d3d4f0..076fb96 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -201,8 +201,8 @@ func TestGameDetectionSettings(t *testing.T) { if len(cfg.GPUIgnoreProcs) != 2 || cfg.GPUIgnoreProcs[1] != "my-trainer" { t.Fatalf("GPUIgnoreProcs = %v", cfg.GPUIgnoreProcs) } - if cfg.GamePollInterval != 5*time.Second { - t.Fatalf("GamePollInterval = %v, want 5s default", cfg.GamePollInterval) + if cfg.GamePollInterval != 15*time.Second { + t.Fatalf("GamePollInterval = %v, want 15s default", cfg.GamePollInterval) } // Defaults: both detection paths off, ignore list covers our consumers. diff --git a/internal/config/sample.go b/internal/config/sample.go index 050514e..24a8a3b 100644 --- a/internal/config/sample.go +++ b/internal/config/sample.go @@ -35,7 +35,7 @@ func sampleEntries(logFile string) []sampleEntry { {"GAME_PROCS", "cyberpunk2077.exe,hl2.exe", "While a listed process runs, the GPU counts as held by it: requests wait, Ollama unloads, managed ComfyUI stops (default: empty = disabled)", false}, {"GPU_FOREIGN_VRAM_MB", "1024", "Also treat the GPU as held when a process not in GPU_IGNORE_PROCS uses more VRAM than this (needs nvidia-smi; 0/empty = disabled)", false}, {"GPU_IGNORE_PROCS", "ollama,ollama app,ollama_llama_server,python,pythonw", "Process names never counted as foreign GPU users (ComfyUI runs under python)", false}, - {"GAME_POLL_INTERVAL", "5s", "How often game/VRAM detection runs", false}, + {"GAME_POLL_INTERVAL", "15s", "How often game/VRAM detection runs (nvidia-smi polls keep the GPU awake; don't go below ~10s)", false}, {"UNLOAD_TIMEOUT", "60s", "How long to wait for Ollama to unload a model", false}, {"JOB_TIMEOUT", "15m", "Maximum time to wait for a ComfyUI job", false}, {"LLM_WAIT_TIMEOUT", "10m", "Max time an LLM request waits for the GPU before being answered 503 (wait mode)", false},