fix(envoy-client): clear processed_command_idx after ack send#4812
Conversation
Code ReviewOverviewThis PR clears Correctness: Scope of the Clear is RightThe cleanup loop iterates Race Condition (Acknowledged TODO)The TODO comment describes a real correctness gap:
The window is narrow (bytes-in-flight vs. FDB commit gap), but it is real. The proper fix is an ack-of-ack from Minor: Unnecessary Clone
let cleanup_keys: Vec<(String, u32)> = last_command_checkpoints
.iter()
.map(|cp| (cp.actor_id.clone(), cp.generation))
.collect();
ws_send(
&ctx.shared,
protocol::ToRivet::ToRivetAckCommands(protocol::ToRivetAckCommands {
last_command_checkpoints,
}),
)
.await;
for (actor_id, generation) in cleanup_keys {
ctx.processed_command_idx.remove(&(actor_id, generation));
}Missing Test Coverage
Comment StyleThe TODO block is seven lines long. Project conventions say one short line max. A one-liner like |
f65d4b3 to
5c033a7
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: