fix(pb-envoy): reduce round trips for ws connection#4603
Conversation
|
The core optimization is solid. Moving the version to the URL query param and having the server immediately push the init packet instead of waiting for a client round trip is a clean improvement. Critical Bug: is_serverless always false in Conn In engine/packages/pegboard-envoy/src/conn.rs, Arc::new(Conn) at the end of init_conn hardcodes is_serverless: false (line 326) instead of the computed local variable from tokio::try_join. Two places are affected:
Fix: change is_serverless: false to is_serverless in the struct literal. Units inconsistency: drain_grace_period The deprecated serverless_drain_grace_period config is in milliseconds (default 10,000 ms = 10 s). The new drain_grace_period field is documented as Seconds but uses the same raw value 10,000. If truly seconds that is ~2.7 hours. The Seconds doc comment is likely wrong and should say Milliseconds. Default fallback does not read the actual deprecated config value The comment says Default to deprecated config value but the code hardcodes 10,000 rather than reading config.pegboard.serverless_drain_grace_period. A non-default operator value will be silently ignored. Missing newline at end of file engine/artifacts/errors/ws.timed_out.json is missing a trailing newline. Old error artifact files not removed WsError::ConnectionClosed and WsError::TimedOutWaitingForInit were removed from errors.rs but ws.connection_closed.json and ws.timed_out_waiting_for_init.json were not deleted. Unrelated changes in examples/cursors/package.json Adds @hono/node-server and hono deps and removes trailing newline. Should be a separate PR. Minor: handle_metadata allows repeated updates Previously written once at init; now runs on every ToRivetMetadata message. Atomicity is fine. Worth a comment confirming this is intentional. Summary: The is_serverless: false bug and the drain_grace_period units issue are the two things that need to be fixed before landing. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: