Skip to content

Commit

Permalink
fix(sync): flush the channel in the p2p server before dropping it
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahakShama committed Aug 8, 2024
1 parent 9834a40 commit d577fc9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/papyrus_p2p_sync/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ where
// If this function fails, we still want to send fin before failing.
let result = send_data_without_fin_for_query(&storage_reader, query, &mut sender).await;
info!("Sending fin message for inbound sync query");
sender.feed(DataOrFin(None)).await?;
// Using send and not feed because dropping a Sink doesn't necessarily flush it. Calling send
// is equivalent to calling feed and flush.
sender.send(DataOrFin(None)).await?;
result
}

Expand Down

0 comments on commit d577fc9

Please sign in to comment.