Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shut down subscriber read loop correctly #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 14, 2024

  1. Shut down subscriber read loop correctly

    readLoop was leaking goroutines when subscribers were unsubscribed,
    because it was blocked trying to write a nil to erChan in response to an
    upstream io.EOF.
    
    This commit passes in a context to startReadLoop, ensuring that when
    that context is closed, the read loop terminates correctly.
    
    For SubscribeWithContext we just pass in the parent context, as there is
    no way to unsubscribe the handler.
    
    For SubscribeChanWithContext, we pass in a derived cancelable context,
    which we cancel explicitly when the channel is unsubscribed.
    nickstenning committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    c7e9f9a View commit details
    Browse the repository at this point in the history