mirror of
https://github.com/penpot/penpot.git
synced 2026-09-30 15:56:17 +00:00
🐛 Fix MCP plugin reconnect loop on duplicate connection (#11520)
The MCP server closes duplicate plugin connections with 1008 (policy violation). The plugin treated every close as retryable: shouldReconnect stayed true, scheduleReconnect re-armed, and each brief onopen reset the backoff - looping at ~1s until the browser froze. Treat 1008 closes as terminal and stay disconnected until the user reconnects explicitly.
This commit is contained in:
parent
128c495b2a
commit
9b3594748c
@ -255,6 +255,15 @@ function connectToMcpServer(baseUrl?: string, token?: string): void {
|
||||
updateCurrentTask(null);
|
||||
}
|
||||
ws = null;
|
||||
if (event.code === 1008) {
|
||||
// Policy violation (e.g. duplicate connection for the same user
|
||||
// token - another tab already holds the connection). Retrying
|
||||
// would be refused again immediately, so stay disconnected
|
||||
// until the user explicitly reconnects.
|
||||
shouldReconnect = false;
|
||||
cancelReconnect();
|
||||
return;
|
||||
}
|
||||
scheduleReconnect();
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user