Skip to content

Commit 870fb16

Browse files
committed
server: Do not send back TooExpensive errors for subscriptions
1 parent 6466b89 commit 870fb16

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

server/websocket/src/connection.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,19 @@ where
325325
// Send errors back to the client as GQL_DATA
326326
match e {
327327
SubscriptionError::GraphQLError(e) => {
328-
let result = Arc::new(QueryResult::from(e));
329-
let msg =
330-
OutgoingMessage::from_query_result(err_id.clone(), result);
331-
error_sink.unbounded_send(msg.into()).unwrap();
328+
// Don't bug clients with transient `TooExpensive` errors,
329+
// simply skip updating them
330+
if !e
331+
.iter()
332+
.any(|err| matches!(err, QueryExecutionError::TooExpensive))
333+
{
334+
let result = Arc::new(QueryResult::from(e));
335+
let msg = OutgoingMessage::from_query_result(
336+
err_id.clone(),
337+
result,
338+
);
339+
error_sink.unbounded_send(msg.into()).unwrap();
340+
}
332341
}
333342
};
334343
})

0 commit comments

Comments
 (0)