fix: keep push connections open while the service is starting - #25485
fix: keep push connections open while the service is starting#25485mcollovati wants to merge 1 commit into
Conversation
|
If we plan to backport to other 25 and 24 branches, it will need manual pick because of the new test module. |
Push connect/message now waits for the service instead of running immediatelyflowchart LR
subgraph Before
direction TB
B1["onConnect / onMessage"] -->|runs immediately| B2["doOnConnect (uses service)"]
B2 -.->|service still starting| B3["connection fails"]
end
subgraph After
direction TB
A1["onConnect / onMessage"] -->|deferUntilServiceReady| A2{"service.isInitialized()?"}
A2 -->|yes| A3["doOnConnect"]
A2 -->|"no (new)"| A4["suspend(resource) + whenInitialized()"]:::changed
A4 -->|init ok| A3
A4 -->|init failed| A5["closeResource()"]:::changed
A4 -.->|client gave up| A6["drop"]
end
Before ~~~ After
classDef changed stroke:#c9a227,stroke-width:3px
Diagram Bot draws the mechanism this pull request touches; it does not review the change. Verify it against the diff.
|
ecdcced to
54d17f7
Compare
The push endpoint can be reached before the Vaadin service has finished starting. A browser tab that keeps retrying its connection, for example one left open across a server restart, could therefore connect too early and the connection failed with an error. Such a connection is now held until startup finishes and is then handled as usual. Closing it instead would make the browser fall back to a slower connection type for the rest of the page's life. The connection is closed only if startup fails, and is dropped if the browser gives up while waiting. Fixes #25482
54d17f7 to
31249ce
Compare
|



The push endpoint can be reached before the Vaadin service has finished starting. A browser tab that keeps retrying its connection, for example one left open across a server restart, could therefore connect too early and the connection failed with an error.
Such a connection is now held until startup finishes and is then handled as usual. Closing it instead would make the browser fall back to a slower connection type for the rest of the page's life. The connection is closed only if startup fails, and is dropped if the browser gives up while waiting.
Fixes #25482