Skip to content

[Subscription] check already closed channels #384

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

Merged
merged 2 commits into from
Jun 28, 2025

Conversation

cheina97
Copy link
Contributor

@cheina97 cheina97 commented Jun 11, 2025

This PR fixes an issue I encountered using subscriptions with genqlient.

I've noticed that the Unsubscribe function closes the subscription channel, but never checks if that channel has already been closed.

So a snippet like that causes a panic when Close is called:

err = gqlsubcl.Unsubscribe(subscriptionID)
if err != nil {
	return fmt.Errorf("failed to unsubscribe from GraphQL subscription: %w", err)
}

if err := gqlsubcl.Close(); err != nil {
	return fmt.Errorf("failed to close GraphQL subscription client: %w", err)
}

I have:

  • Written a clear PR title and description (above)
  • Signed the Khan Academy CLA
  • Added tests covering my changes, if applicable
  • Included a link to the issue fixed, if applicable
  • Included documentation, for new features
  • Added an entry to the changelog

@cheina97 cheina97 force-pushed the frc/closesubfix branch 4 times, most recently from 65e2b5b to cf0bc31 Compare June 20, 2025 14:38
@cheina97 cheina97 requested a review from benjaminjkraft June 20, 2025 14:38
@cheina97 cheina97 force-pushed the frc/closesubfix branch 2 times, most recently from 5232179 to e458f18 Compare June 20, 2025 14:42
Copy link
Collaborator

@benjaminjkraft benjaminjkraft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good now! I forgot to mention earlier, could you add a changelog entry? Once you do I think we're good!

@cheina97
Copy link
Contributor Author

Thanks, this looks good now! I forgot to mention earlier, could you add a changelog entry? Once you do I think we're good!

Yes, I just did it

@cheina97 cheina97 requested a review from benjaminjkraft June 23, 2025 07:38
@cheina97
Copy link
Contributor Author

@benjaminjkraft, is it ok?

Copy link
Collaborator

@benjaminjkraft benjaminjkraft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@benjaminjkraft benjaminjkraft merged commit b1fe42c into Khan:main Jun 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants