8000 Always close transport when an exception appears during the transport connect by leszekhanusz · Pull Request #488 · graphql-python/gql · GitHub
[go: up one dir, main page]

Skip to content

Always close transport when an exception appears during the transport connect #488

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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Close transport when exception appears during connect
  • Loading branch information
leszekhanusz committed Jul 14, 2024
commit 9867f2b7c79b3f095d08ce30711fb068c53b84e6
6 changes: 5 additions & 1 deletion gql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,11 @@ async def connect_async(self, reconnecting=False, **kwargs):
self.session = ReconnectingAsyncClientSession(client=self, **kwargs)
await self.session.start_connecting_task()
else:
await self.transport.connect()
try:
await self.transport.connect()
except Exception as e:
await self.transport.close()
raise e
self.session = AsyncClientSession(client=self)

# Get schema from transport if needed
Expand Down
Loading
0