Files
9router/src/app/api/proxy-pools/fitness/clear-all/route.js
T
MUH. IQRAM BAHRING fd22290a34 feat(proxy-fitness): pool fitness registry + Smart rotation + pool-scoped retry
Pool/IP fitness registry (globalThis-backed, provider::model scopes, 5-min
cooldown, provider::* wildcard) fed by pool-scoped failures: freebuff
limited-IP / model-locked gates and opencode free per-IP limits. chatCore
retries a failed pool via another pool without locking the account; new
Smart rotation strategy (per-connection + no-auth providers) skips unfit
pools. Proxy Fitness dashboard page: active-block table with provider/IP
filters, per-record Clear and provider-scoped Clear All; egress column via
pool geo enrichment. Unit tests for the registry.
2026-08-07 03:51:19 +08:00

22 lines
830 B
JavaScript

import { NextResponse } from "next/server";
import { clearAllPoolUnfit } from "open-sse/services/proxyPoolFitness.js";
// POST /api/proxy-pools/fitness/clear-all
// Body: { provider?: string } — clears every mark, or only marks scoped to the
// given provider ("provider::*") when provided.
export async function POST(request) {
try {
let body = {};
try {
body = await request.json();
} catch {
body = {};
}
const provider = typeof body?.provider === "string" && body.provider.trim() ? body.provider.trim() : null;
clearAllPoolUnfit(provider);
return NextResponse.json({ ok: true, provider: provider || null });
} catch (error) {
console.log("Error clearing proxy fitness:", error);
return NextResponse.json({ error: "Failed to clear proxy fitness" }, { status: 500 });
}
}