Fix Graphql-WS errors and Improve Downloader Subscription (#634)
* Fix errors in graphql-ws * Send download messages more often
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user