mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
report failed requests from RPC after being clear from rate limiter but not yet sent. (#5942)
* report failed rpc requests from RPC
This commit is contained in:
@@ -316,6 +316,27 @@ where
|
||||
self.events.push(error_msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace the pending Requests to the disconnected peer
|
||||
// with reports of failed requests.
|
||||
self.events.iter_mut().for_each(|event| match &event {
|
||||
ToSwarm::NotifyHandler {
|
||||
peer_id: p,
|
||||
event: RPCSend::Request(request_id, req),
|
||||
..
|
||||
} if *p == peer_id => {
|
||||
*event = ToSwarm::GenerateEvent(RPCMessage {
|
||||
peer_id,
|
||||
conn_id: connection_id,
|
||||
event: HandlerEvent::Err(HandlerErr::Outbound {
|
||||
id: *request_id,
|
||||
proto: req.versioned_protocol().protocol(),
|
||||
error: RPCError::Disconnected,
|
||||
}),
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user