You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ktor subscription solution uses Flow::flatMapMerge which has a default concurrency of 16. This lead to the websocket hanging when I sent more than 16 different subscription messages in one connection.
As a workaround in my project I copied the GraphQLWebSocketServer implementation with a very small modification for the SubscriptionMessageSubscribe
if (subscriptions.size >=CONCURRENCY) {
logger.warn("Too many subscriptions")
cancelSubscription(session, GraphQLSubscriptionStatus.TOO_MANY_REQUESTS, subscriptions)
return@channelFlow
}
return parseRequestFlow(session, subscriptions)
.flatMapMerge(concurrency =CONCURRENCY) { rawMessage ->// rest of the implementation
}
To reproduce this issue just start up a subscription and send more than 16 subscription messages with different ids. The 17th will not get any response back, also all other message types will stop responding.
It would be great if there would be an option to configure the concurrency number and also to have a cancel when reaching the number to avoid these hangs.
The text was updated successfully, but these errors were encountered:
The ktor subscription solution uses
Flow::flatMapMerge
which has a default concurrency of 16. This lead to the websocket hanging when I sent more than 16 different subscription messages in one connection.As a workaround in my project I copied the
GraphQLWebSocketServer
implementation with a very small modification for theSubscriptionMessageSubscribe
To reproduce this issue just start up a subscription and send more than 16 subscription messages with different ids. The 17th will not get any response back, also all other message types will stop responding.
It would be great if there would be an option to configure the concurrency number and also to have a cancel when reaching the number to avoid these hangs.
The text was updated successfully, but these errors were encountered: