fix(rivetkit): restore hibernatable sockets and hydrate serverless starts#4658
Conversation
PR Review: fix(rivetkit): restore hibernatable sockets and hydrate serverless startsStatus: DRAFT OverviewThis PR fixes two related issues:
The approach is sound: introduce explicit Issues & ObservationsMinor BugsInconsistent error field in logger (dynamic actor restore block) Every other logger call in this file uses Binding inserted into map before Between the this.#hibernatableRunnerWebSocketBindings.set(key, binding);
// ... await runtime.openWebSocket(...) -- async gap here
binding.proxyToActorWs = proxyToActorWs;Design ObservationsMagic 100 ms wait in The name implies the wait is sufficient for registration, but it is still a fixed delay. On CI under load this could still be racy. Consider whether this can be replaced with a deterministic signal (e.g., polling a count endpoint) as was done in
const minStartCount = options?.minStartCount ?? minSleepCount + 1;This embeds the invariant that O(n) scan in Both methods iterate the entire flat map and filter by Binding cleanup on forced shutdown In Test CoverageThe removal of intermediate-state assertions in the raw WebSocket sleep tests (e.g., verifying The gateway routing URL changes ( Positive
|
26f98bc to
fde1e0b
Compare
ccc38b5 to
8293235
Compare
fde1e0b to
789b9cd
Compare
8293235 to
1ba6a3b
Compare

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: