mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 05:12:11 +03:00
fix(quota): orphan pool (no valid connection) must not contribute its slug to key scope
D2 moved poolSlug collection outside the connection loop, so a pool whose only connection was deleted still leaked its slug into resolveQuotaKeyScope — that slug has no quotaShared-* models behind it. Gate the slug on >=1 valid member connection (restores Phase-A2 behavior for multi-connection pools).
This commit is contained in:
@@ -79,6 +79,7 @@ export async function resolveQuotaKeyScope(
|
||||
? pool.connectionIds
|
||||
: [pool.connectionId];
|
||||
|
||||
let anyValidConnection = false;
|
||||
for (const connId of connIds) {
|
||||
const connection = await getProviderConnectionById(connId);
|
||||
if (!connection) continue; // missing connection contributes nothing; don't abort
|
||||
@@ -88,9 +89,13 @@ export async function resolveQuotaKeyScope(
|
||||
|
||||
connectionIdSet.add(connId);
|
||||
providerSet.add(provider);
|
||||
anyValidConnection = true;
|
||||
}
|
||||
|
||||
poolSlugSet.add(quotaPoolSlug(pool.name));
|
||||
// Only expose the pool's slug when it has at least one usable connection —
|
||||
// an orphan pool (all connections deleted) has no quotaShared-* models, so
|
||||
// its slug must not leak into the key's scope.
|
||||
if (anyValidConnection) poolSlugSet.add(quotaPoolSlug(pool.name));
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user