Avoid goroutine bloat in subscriptions
masterWhen using relay.Subscribe, you must manage the lifecycle of the subscription to prevent goroutine leaks. If you stop listening to the sub.Events channel without properly closing the subscription, the library will continue to spawn goroutines for every new event that arrives.
To prevent this:
- Ensure the
context.Contextpassed toSubscribeis eventually canceled. - Or, explicitly call
.Unsub()on the subscription object.