feat(proxy-fitness): on/off toggle for egress geo probe

Header toggle in Proxy Fitness persists settings.poolGeoProbeEnabled
(default on); the probe scheduler reads it each pass and skips when off.
The env POOL_GEO_PROBE_DISABLED remains a hard override. Smart rotation is
unaffected — it runs off the fitness registry from real request failures.
This commit is contained in:
MUH. IQRAM BAHRING
2026-08-07 08:01:55 +08:00
parent a443834f53
commit 37d03aa0d5
2 changed files with 49 additions and 1 deletions
+8
View File
@@ -10,6 +10,7 @@
import { getProxyPools } from "@/models";
import { probePoolGeo, setPoolGeo, getPoolGeo } from "open-sse/services/poolGeo.js";
import { isNonServerRuntime } from "@/sse/services/backgroundTokenRefresh.js";
import { getSettings } from "@/lib/localDb";
const PROBE_INTERVAL_MS = 30 * 60 * 1000;
const INITIAL_DELAY_MS = 15 * 1000;
@@ -44,6 +45,13 @@ async function probeAll() {
if (probing) return;
probing = true;
try {
// UI toggle (settings.poolGeoProbeEnabled) gates the whole feature; the
// env var remains a hard override for headless setups.
try {
const settings = await getSettings();
if (settings?.poolGeoProbeEnabled === false) return;
} catch { /* DB hiccup — keep probing (fail-open) */ }
const pools = await getProxyPools({ isActive: true });
const now = Date.now();
const active = (pools || []).filter((p) => !!p?.proxyUrl);