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

We are getting TransportAlreadyConnected on random query calls #95

Closed
andchiind opened this issue Jan 11, 2024 · 0 comments · Fixed by #96
Closed

We are getting TransportAlreadyConnected on random query calls #95

andchiind opened this issue Jan 11, 2024 · 0 comments · Fixed by #96
Labels
bug Something isn't working

Comments

@andchiind
Copy link
Contributor

andchiind commented Jan 11, 2024

Describe the bug
Query calls will occasionally return this exception in query() in graphql_client.py: https://gql.readthedocs.io/en/stable/modules/transport_exceptions.html#gql.transport.exceptions.TransportAlreadyConnected

The issue seems to be that we should only connect to a session once within a thread, but in the self.client.execute function call in the query function, we are attempting to start a connection before sending a request. A solution to this might be to get a session object from the client, and then use this object when making query calls. Getting this session without making both the GraphqlClient and EnergyRoboticsApi classes async.

It seems that our Client object in the GraphqlClient class is not actually activated until we call execute, as mention in the documentation:
image

This may also be relevant:
https://gql.readthedocs.io/en/stable/advanced/async_permanent_session.html

Unfortunately, using the client.connect_sync() function returns an error, whilst client.connect_async() is not an option since we cannot allow the GraphqlClient class to have an async constructor.

To Reproduce
Start a mission using the ISAR API. You may need to do this a couple of times.

Expected behavior
No exception should occur

Screenshots

@andchiind andchiind added the bug Something isn't working label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant