fix(provider::ws): ignore the websocket response when the request has been cancelled. (#641)

This commit is contained in:
guanqun 2021-12-04 02:14:13 +08:00 committed by GitHub
parent 9fc75ef245
commit 8d07610e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -313,7 +313,9 @@ where
Err(_) => {} Err(_) => {}
Ok(Incoming::Response(resp)) => { Ok(Incoming::Response(resp)) => {
if let Some(request) = self.pending.remove(&resp.id) { if let Some(request) = self.pending.remove(&resp.id) {
request.send(resp.data.into_result()).map_err(to_client_error)?; if !request.is_canceled() {
request.send(resp.data.into_result()).map_err(to_client_error)?;
}
} }
} }
Ok(Incoming::Notification(notification)) => { Ok(Incoming::Notification(notification)) => {