Fixed a bug that websocket could not push data in a situation.
@@ -75,9 +75,10 @@ where
type Item = String;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
- let this = self.project();
+ let mut this = self.project();
- match this.stream.poll_next(cx) {
+ loop {
+ match Pin::new(&mut this.stream).poll_next(cx) {
Poll::Ready(message) => {
let message = match message {
Some(message) => message,
@@ -124,8 +125,10 @@ where
this.streams.insert(
id,
Box::pin(
- this.schema
- .execute_stream_with_ctx_data(request, Arc::clone(this.data)),
+ this.schema.execute_stream_with_ctx_data(
+ request,
+ Arc::clone(this.data),
+ ),
),
);
}
@@ -139,7 +142,8 @@ where
ClientMessage::ConnectionTerminate => return Poll::Ready(None),
}
}
- Poll::Pending => {}
+ Poll::Pending => break,
+ }
}
for (id, stream) in &mut *this.streams {
