()
| 879 | const INFLIGHT_STALE_MS = 120_000; |
| 880 | let _inflightCleanupTimer = null; |
| 881 | function startInflightCleanup() { |
| 882 | if (_inflightCleanupTimer) return; |
| 883 | _inflightCleanupTimer = setInterval(() => { |
| 884 | const now = Date.now(); |
| 885 | for (const a of accounts) { |
| 886 | if ((a._inflight || 0) > 0 && a._inflightAt && (now - a._inflightAt) > INFLIGHT_STALE_MS) { |
| 887 | log.warn(`Account ${safeAccountRef(a)} inflight=${a._inflight} stale >${Math.round((now - a._inflightAt) / 1000)}s, auto-resetting`); |
| 888 | a._inflight = 0; |
| 889 | a._inflightAt = 0; |
| 890 | } |
| 891 | } |
| 892 | }, 60_000).unref(); |
| 893 | } |
| 894 | |
| 895 | /** |
| 896 | * Try to re-check-out a specific account by apiKey, applying the same |
no test coverage detected