File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -360,8 +360,15 @@ extension WebSocketTransport: NetworkTransport {
360360 contextIdentifier: UUID ? = nil ,
361361 callbackQueue: DispatchQueue = . main,
362362 completionHandler: @escaping ( Result < GraphQLResult < Operation . Data > , Error > ) -> Void ) -> Cancellable {
363+
364+ func callCompletion( with result: Result < GraphQLResult < Operation . Data > , Error > ) {
365+ callbackQueue. async {
366+ completionHandler ( result)
367+ }
368+ }
369+
363370 if let error = self . error. value {
364- completionHandler ( . failure( error) )
371+ callCompletion ( with : . failure( error) )
365372 return EmptyCancellable ( )
366373 }
367374
@@ -371,12 +378,12 @@ extension WebSocketTransport: NetworkTransport {
371378 let response = GraphQLResponse ( operation: operation, body: jsonBody)
372379 do {
373380 let graphQLResult = try response. parseResultFast ( )
374- completionHandler ( . success( graphQLResult) )
381+ callCompletion ( with : . success( graphQLResult) )
375382 } catch {
376- completionHandler ( . failure( error) )
383+ callCompletion ( with : . failure( error) )
377384 }
378385 case . failure( let error) :
379- completionHandler ( . failure( error) )
386+ callCompletion ( with : . failure( error) )
380387 }
381388 }
382389 }
You can’t perform that action at this time.
0 commit comments