* Recover from onEnvironmentLost (poll returned 404 — env was reaped * server-side). Tries two strategies in order: * * 1. Reconnect-in-place: idempotent re-register with reuseEnvironmentId * → if the backend returns the same env ID, call reconnectSession() * to re-queue t
()
| 603 | * same reconnection attempt. |
| 604 | */ |
| 605 | async function reconnectEnvironmentWithSession(): Promise<boolean> { |
| 606 | if (reconnectPromise) { |
| 607 | return reconnectPromise |
| 608 | } |
| 609 | reconnectPromise = doReconnect() |
| 610 | try { |
| 611 | return await reconnectPromise |
| 612 | } finally { |
| 613 | reconnectPromise = null |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | async function doReconnect(): Promise<boolean> { |
| 618 | environmentRecreations++ |
no test coverage detected