Subscription as iterator to reduce goroutine usage #3309
NateScarlet
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, we need 2+ goroutine for each subscription (1 read by gqlgen, 1 write by resolver, more for data transform).
If we use iterator
func(yield func(T, error) bool)
as return value ,then resolver can push item and do data transform directly in
yield
.So required goroutine for each subscription can be reduced to 1.
This also allows return error during subscription without using
transport.AddSubscriptionError
current subscription resolver
require 1 goroutine
proposed subscription resolver
no goroutine needed
Beta Was this translation helpful? Give feedback.
All reactions