Elevator Pitch
In environments with rapid editor events and custom transports, multiple concurrent connect() calls can race for the same virtualDocument.uri.
In jupyterlab/plugin-playground PR #225, we patch ILSPDocumentConnectionManager.connect() at runtime and maintain a pendingConnects map keyed by URI to dedupe in-flight connects.
This behavior should be in core to avoid monkeypatches and duplicated downstream fixes.
Design Ideas
Implement built-in in-flight dedupe in DocumentConnectionManager.connect():
- Before creating a connection, check:
- existing settled connection for URI
- existing pending connect promise for URI
- Reuse pending promise when available.
- Clear pending state on settle (success/failure).
An alternative is exposing an official policy hook for connect coalescing, but built-in dedupe seems broadly useful.
Elevator Pitch
In environments with rapid editor events and custom transports, multiple concurrent
connect()calls can race for the samevirtualDocument.uri.In
jupyterlab/plugin-playgroundPR #225, we patchILSPDocumentConnectionManager.connect()at runtime and maintain apendingConnectsmap keyed by URI to dedupe in-flight connects.This behavior should be in core to avoid monkeypatches and duplicated downstream fixes.
Design Ideas
Implement built-in in-flight dedupe in
DocumentConnectionManager.connect():An alternative is exposing an official policy hook for connect coalescing, but built-in dedupe seems broadly useful.