Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f46ee5

Browse files
committed
Don't double box subscription streams
1 parent 082201c commit 8f46ee5

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/dynamic/schema.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{any::Any, collections::HashMap, fmt::Debug, sync::Arc};
22

33
use async_graphql_parser::types::OperationType;
4-
use futures_util::{Stream, StreamExt, TryFutureExt, stream::BoxStream};
4+
use futures_util::{StreamExt, TryFutureExt, stream::BoxStream};
55
use indexmap::IndexMap;
66

77
use crate::{
@@ -410,7 +410,7 @@ impl Schema {
410410
&self,
411411
request: impl Into<DynamicRequest>,
412412
session_data: Arc<Data>,
413-
) -> impl Stream<Item = Response> + Send + Unpin + 'static {
413+
) -> BoxStream<'static, Response> {
414414
let schema = self.clone();
415415
let request = request.into();
416416
let extensions = self.create_extensions(session_data.clone());
@@ -473,7 +473,7 @@ impl Schema {
473473
pub fn execute_stream(
474474
&self,
475475
request: impl Into<DynamicRequest>,
476-
) -> impl Stream<Item = Response> + Send + Unpin {
476+
) -> BoxStream<'static, Response> {
477477
self.execute_stream_with_session_data(request, Default::default())
478478
}
479479

@@ -495,7 +495,6 @@ impl Executor for Schema {
495495
session_data: Option<Arc<Data>>,
496496
) -> BoxStream<'static, Response> {
497497
Schema::execute_stream_with_session_data(self, request, session_data.unwrap_or_default())
498-
.boxed()
499498
}
500499
}
501500

src/schema.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
};
77

88
use async_graphql_parser::types::ExecutableDocument;
9-
use futures_util::stream::{self, BoxStream, FuturesOrdered, Stream, StreamExt};
9+
use futures_util::stream::{self, BoxStream, FuturesOrdered, StreamExt};
1010

1111
use crate::{
1212
BatchRequest, BatchResponse, CacheControl, ContextBase, EmptyMutation, EmptySubscription,
@@ -574,7 +574,7 @@ where
574574
&self,
575575
request: impl Into<Request>,
576576
session_data: Arc<Data>,
577-
) -> impl Stream<Item = Response> + Send + Unpin + 'static {
577+
) -> BoxStream<'static, Response> {
578578
let schema = self.clone();
579579
let request = request.into();
580580
let extensions = self.create_extensions(session_data.clone());
@@ -642,10 +642,7 @@ where
642642
}
643643

644644
/// Execute a GraphQL subscription.
645-
pub fn execute_stream(
646-
&self,
647-
request: impl Into<Request>,
648-
) -> impl Stream<Item = Response> + Send + Unpin {
645+
pub fn execute_stream(&self, request: impl Into<Request>) -> BoxStream<'static, Response> {
649646
self.execute_stream_with_session_data(request, Default::default())
650647
}
651648
}
@@ -667,7 +664,6 @@ where
667664
session_data: Option<Arc<Data>>,
668665
) -> BoxStream<'static, Response> {
669666
Schema::execute_stream_with_session_data(&self, request, session_data.unwrap_or_default())
670-
.boxed()
671667
}
672668
}
673669

0 commit comments

Comments
 (0)