({ skipBusy = false } = {})
| 1456 | } |
| 1457 | |
| 1458 | export async function refreshAllCredits({ skipBusy = false } = {}) { |
| 1459 | const results = []; |
| 1460 | for (const a of accounts) { |
| 1461 | if (a.status !== 'active') continue; |
| 1462 | if (skipBusy) { |
| 1463 | const busyReason = maintenanceBusyReason(a); |
| 1464 | if (busyReason) { |
| 1465 | results.push({ id: a.id, email: a.email, ok: false, skipped: true, reason: busyReason }); |
| 1466 | continue; |
| 1467 | } |
| 1468 | } |
| 1469 | const r = await refreshCredits(a.id); |
| 1470 | results.push({ id: a.id, email: a.email, ok: r.ok, error: r.error }); |
| 1471 | } |
| 1472 | return results; |
| 1473 | } |
| 1474 | |
| 1475 | /** |
| 1476 | * Update the capability of an account for a specific model. |
no test coverage detected