Add exponential backoff retry to all downstream calls

New controller/retry.js wraps async calls with infinite retries, capped

at 30s with jitter. Applied to: TPB search, TMDB, Emby, Ollama chat,

Transmission RPC, and the status/status interval calls inherit it via

a Proxy around the Transmission client.

Also handles ollama package returning pre-parsed JSON objects.

Signed-off-by: William Mantly <wmantly@gmail.com>
This commit is contained in:
2026-07-20 14:44:41 -04:00
parent 803a6db033
commit 51e6817393
8 changed files with 147 additions and 51 deletions
+4 -1
View File
@@ -41,7 +41,10 @@ async function chatJSON(system, user){
{ role: 'user', content: user },
],
});
return extractJSON(res.message && res.message.content);
// The ollama package may return message.content as a JSON string when format:'json' is used.
let content = res.message && res.message.content;
if(typeof content === 'string') return extractJSON(content);
return content;
}
module.exports = { client, chatJSON, extractJSON };