Fix Graphql-WS errors and Improve Downloader Subscription (#634)

* Fix errors in graphql-ws

* Send download messages more often
This commit is contained in:
Mitchell Syer
2023-08-04 22:48:41 -04:00
committed by GitHub
parent 689847d864
commit cdce368042
2 changed files with 4 additions and 5 deletions
@@ -112,7 +112,7 @@ class ApolloSubscriptionProtocolHandler(
return subscriptionHandler.executeSubscription(request, graphQLContext)
.map {
if (it.errors?.isNotEmpty() == true) {
SubscriptionOperationMessage(type = GQL_ERROR.type, id = operationMessage.id, payload = it)
SubscriptionOperationMessage(type = GQL_ERROR.type, id = operationMessage.id, payload = it.errors)
} else {
SubscriptionOperationMessage(type = GQL_NEXT.type, id = operationMessage.id, payload = it)
}
@@ -132,12 +132,11 @@ object DownloadManager {
}
private fun notifyAllClients(immediate: Boolean = false) {
scope.launch {
notifyFlow.emit(Unit)
}
if (immediate) {
sendStatusToAllClients()
} else {
scope.launch {
notifyFlow.emit(Unit)
}
}
/*if (downloadChapter != null) { TODO GRAPHQL
downloadSubscriptionSource.publish(downloadChapter)