File tree Expand file tree Collapse file tree
Sources/GraphQL/Subscription Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ func subscribe(
5656 subscribeFieldResolver: subscribeFieldResolver
5757 )
5858
59- return sourceFuture. flatMap { subscriptionResult -> EventLoopFuture < SubscriptionResult > in
59+ return sourceFuture. map { subscriptionResult -> SubscriptionResult in
6060 do {
6161 let subscriptionObserver = try subscriptionResult. get ( )
6262 let eventObserver = subscriptionObserver. map { eventPayload -> GraphQLResult in
@@ -80,13 +80,14 @@ func subscribe(
8080 variableValues: variableValues,
8181 operationName: operationName
8282 ) . wait ( ) // TODO remove this wait
83-
8483 return eventResolved
8584 }
8685 // TODO Making a future here feels it indicates a mistake...
87- return eventLoopGroup . next ( ) . makeSucceededFuture ( SubscriptionResult . success ( eventObserver) )
86+ return SubscriptionResult . success ( eventObserver)
8887 } catch let graphQLError as GraphQLError {
89- return eventLoopGroup. next ( ) . makeSucceededFuture ( SubscriptionResult . failure ( graphQLError) )
88+ return SubscriptionResult . failure ( graphQLError)
89+ } catch let error {
90+ return SubscriptionResult . failure ( GraphQLError ( error) )
9091 }
9192 }
9293}
You can’t perform that action at this time.
0 commit comments