fix(healthcheck): apply proxy resolution per connection in sweeping loop (#1051)

This commit is contained in:
diegosouzapw
2026-04-08 03:45:44 -03:00
parent 4af7a1896c
commit 3c50ffa18e

View File

@@ -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();