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 }> = []; const inCooldown: Array<{ profileId: string; cooldownUntil: number }> = [];
for (const profileId of deduped) { for (const profileId of deduped) {
const cooldownUntil = resolveProfileUnusableUntil(store.usageStats?.[profileId] ?? {}) ?? 0; if (isProfileInCooldown(store, profileId)) {
if ( const cooldownUntil =
typeof cooldownUntil === "number" && resolveProfileUnusableUntil(store.usageStats?.[profileId] ?? {}) ?? now;
Number.isFinite(cooldownUntil) &&
cooldownUntil > 0 &&
now < cooldownUntil
) {
inCooldown.push({ profileId, cooldownUntil }); inCooldown.push({ profileId, cooldownUntil });
} else { } else {
available.push(profileId); available.push(profileId);