Auth: use cooldown helper in explicit profile order

This commit is contained in:
Vincent Koc
2026-02-24 18:45:38 -05:00
parent daa4f34ce8
commit f1d5c1a31f

View File

@@ -102,13 +102,9 @@ export function resolveAuthProfileOrder(params: {
const inCooldown: Array<{ profileId: string; cooldownUntil: number }> = [];
for (const profileId of deduped) {
const cooldownUntil = resolveProfileUnusableUntil(store.usageStats?.[profileId] ?? {}) ?? 0;
if (
typeof cooldownUntil === "number" &&
Number.isFinite(cooldownUntil) &&
cooldownUntil > 0 &&
now < cooldownUntil
) {
if (isProfileInCooldown(store, profileId)) {
const cooldownUntil =
resolveProfileUnusableUntil(store.usageStats?.[profileId] ?? {}) ?? now;
inCooldown.push({ profileId, cooldownUntil });
} else {
available.push(profileId);