Stop reconnecting after backend disconnects - #13302
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
fac6dcc to
4e5d7f1
Compare
742e136 to
7ab0897
Compare
7ab0897 to
125f5c5
Compare
125f5c5 to
9a8f1f4
Compare
| const connectionError: EngineConnectionError = { | ||
| kind: EngineConnectionErrorKind.BackendDisconnect, | ||
| message: backendDisconnectError.message, | ||
| terminal: true, | ||
| } | ||
| tearDownManager({ websocketClosed: true, connectionError }) |
There was a problem hiding this comment.
This is where we reuse the detection introduced for client error reporting to prevent further reconnect attempts.
| export enum EngineConnectionErrorKind { | ||
| BackendDisconnect = 'backend-disconnect', | ||
| } | ||
|
|
||
| export type EngineConnectionError = { | ||
| kind: EngineConnectionErrorKind | ||
| message: string | ||
| terminal: boolean | ||
| } | ||
|
|
||
| export type EngineDisconnectEventDetail = { | ||
| code?: string | ||
| connectionError?: EngineConnectionError | ||
| } | ||
|
|
There was a problem hiding this comment.
I have upcoming work at #13328, https://github.com/KittyCAD/api/pull/4472, and KittyCAD/modeling-api#1340 to get proper error types and use that instead of the string parsing.
|
A small edge case I haven't reproduced: the idle callback still seems to be activated when the backend disconnects, so this can happen:
I'm thinking if we're on the disconnection page, the idle state shouldn't be triggered ideally, but a simpler fix is to guard all automatic reconnections with something like: It doesn't feel like a big issue though. |
|
Confirmed my finding is fixed! |
Closes #13163.
What
auth_token_missingresponseWhy
This is intentionally the smallest deployable compatibility change for today's untyped backend-disconnect response. It introduces the shared terminal-error plumbing but no broader error taxonomy or new API response types. #13328 is stacked on this PR and replaces the legacy message match with the typed protocol.
How to test
Expected behavior: