Skip to content

Commit

Permalink
chore: drain fetching transaction events (paradigmxyz#5309)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gooong authored Nov 5, 2023
1 parent 2892f02 commit 390abf3
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions crates/net/network/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,18 +778,17 @@ where

this.update_request_metrics();

let fetch_event = this.transaction_fetcher.poll(cx);
match fetch_event {
Poll::Ready(FetchEvent::TransactionsFetched { peer_id, transactions }) => {
if let Some(txns) = transactions {
this.import_transactions(peer_id, txns, TransactionSource::Response);
// drain fetching transaction events
while let Poll::Ready(fetch_event) = this.transaction_fetcher.poll(cx) {
match fetch_event {
FetchEvent::TransactionsFetched { peer_id, transactions } => {
if let Some(txns) = transactions {
this.import_transactions(peer_id, txns, TransactionSource::Response);
}
}
FetchEvent::FetchError { peer_id, error } => {
this.on_request_error(peer_id, error);
}
}
Poll::Ready(FetchEvent::FetchError { peer_id, error }) => {
this.on_request_error(peer_id, error);
}
Poll::Pending => {
// No event ready at the moment, nothing to do here.
}
}

Expand Down

0 comments on commit 390abf3

Please sign in to comment.