From 3c50ffa18efdbfd1d38ca0b852fb114fd6ff0c30 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Wed, 8 Apr 2026 03:45:44 -0300 Subject: [PATCH] fix(healthcheck): apply proxy resolution per connection in sweeping loop (#1051) --- src/lib/tokenHealthCheck.ts | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/lib/tokenHealthCheck.ts b/src/lib/tokenHealthCheck.ts index 95a090b166..f265182205 100644 --- a/src/lib/tokenHealthCheck.ts +++ b/src/lib/tokenHealthCheck.ts @@ -10,7 +10,7 @@ * updates the DB, and logs the result. */ -import { getProviderConnections, updateProviderConnection, getSettings } from "@/lib/localDb"; +import { getProviderConnections, updateProviderConnection, getSettings, resolveProxyForConnection } from "@/lib/localDb"; import { getAccessToken, supportsTokenRefresh, @@ -228,17 +228,23 @@ async function checkConnection(conn) { }; const hideLogs = await shouldHideLogs(); - const result = await getAccessToken(conn.provider, credentials, { - info: (tag, msg) => { - if (!hideLogs) console.log(`${LOG_PREFIX} [${tag}] ${msg}`); + const proxyConfig = await resolveProxyForConnection(conn.id); + const result = await getAccessToken( + conn.provider, + credentials, + { + info: (tag, msg) => { + if (!hideLogs) console.log(`${LOG_PREFIX} [${tag}] ${msg}`); + }, + warn: (tag, msg) => { + if (!hideLogs) console.warn(`${LOG_PREFIX} [${tag}] ${msg}`); + }, + error: (tag, msg, extra) => { + if (!hideLogs) console.error(`${LOG_PREFIX} [${tag}] ${msg}`, extra || ""); + }, }, - warn: (tag, msg) => { - if (!hideLogs) console.warn(`${LOG_PREFIX} [${tag}] ${msg}`); - }, - error: (tag, msg, extra) => { - if (!hideLogs) console.error(`${LOG_PREFIX} [${tag}] ${msg}`, extra || ""); - }, - }); + proxyConfig + ); const now = new Date().toISOString();