diff --git a/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh b/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh index 8544e19..f30871e 100755 --- a/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh +++ b/Plugin/unraid/System_Essentials/unraid_api_key_renew.sh @@ -86,8 +86,16 @@ fi # Check if key already exists in the unraid-api registry before creating. # --overwrite generates a new key value every time, invalidating the old one. # Only renew if the registry has lost it. +# +# Timeout was 5s — measured live 2026-07-19 at 2.2-2.7s baseline latency for this +# exact command with the system idle, leaving almost no margin. Any load spike +# (confirmed correlated with resource_watchdog "pressure escalating" events in the +# same log) pushed it past 5s, killing the lookup — the script then couldn't tell +# "timed out" from "genuinely not in the registry" and fell through to the create +# path, logging a false "API key renewed (registry had lost it)" even though the +# on-disk key file's timestamp never actually changed. 15s gives real headroom. log "Checking unraid-api registry for $KEY_NAME..." -EXISTING=$(timeout 5 /usr/local/sbin/unraid-api apikey --name "$KEY_NAME" --json /dev/null) +EXISTING=$(timeout 15 /usr/local/sbin/unraid-api apikey --name "$KEY_NAME" --json /dev/null) KEY=$(echo "$EXISTING" | jq -r '.key // empty' 2>/dev/null) if [[ -n "$KEY" ]]; then