* 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
()
| 612 | * same reconnection attempt. |
| 613 | */ |
| 614 | async function reconnectEnvironmentWithSession(): Promise<boolean> { |
| 615 | if (reconnectPromise) { |
| 616 | return reconnectPromise |
| 617 | } |
| 618 | reconnectPromise = doReconnect() |
| 619 | try { |
| 620 | return await reconnectPromise |
| 621 | } finally { |
| 622 | reconnectPromise = null |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | async function doReconnect(): Promise<boolean> { |
| 627 | environmentRecreations++ |
no test coverage detected