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:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user