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

Error messages when calling Client in async environment OR locking #33

Open
KonnikPahoni opened this issue Sep 14, 2022 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@KonnikPahoni
Copy link

KonnikPahoni commented Sep 14, 2022

Story

I am using this beautiful client in the last months and today I found a bug in our system. This costed me and our partners a lot of time and efforts. We were chasing this bug for two months.

I was creating a single Client instance for the app, which is a usual practice. Then I was calling the instance of Client first with threads, then in asynchronous environment. For two months. At the end it appeared that the problem is related to using qlient.

Problem

Users expect the Client to either implement locking mechanism, or to disallow calling Client from async environment.

Solution

Raise errors when calling Client instance from async environment.

@dfseifert
Copy link
Collaborator

Ciao @KonnikPahoni

Please excuse my late reply.

Do you have some code to replicate this issue?

@KonnikPahoni
Copy link
Author

KonnikPahoni commented Jan 16, 2023

Any code (async-await or threading) that would call the same instance of the client.

Because the client has a state which contains information about the ongoing request. Should be one at a time.

We are still using the client, just creating a new instance on every request.

@dfseifert
Copy link
Collaborator

Okay if you are working in an async environment, i recommend using qlient-aiohttp. it is still in beta but i am planing on releasing a stable version soon.

I will have a look at the problem in the meantime.

Thank you for pointing it out

@dfseifert dfseifert self-assigned this Jan 18, 2023
@dfseifert dfseifert added the bug Something isn't working label Jan 18, 2023
@KonnikPahoni
Copy link
Author

Okay if you are working in an async environment, i recommend using qlient-aiohttp. it is still in beta but i am planing on releasing a stable version soon.

I will have a look at the problem in the meantime.

Thank you for pointing it out

Kudos for your work, it is the only client I found that allows interacting with GraphQL using native Python types!

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

No branches or pull requests

2 participants