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

[Question?] Potential Race Condition in Session Handling with Concurrent Requests #733

Open
quang-megatron opened this issue Aug 16, 2024 · 0 comments

Comments

@quang-megatron
Copy link

quang-megatron commented Aug 16, 2024

Issue

I am using the Shopify Python API to create products across multiple stores. My process involves activating a session for each store before making API requests. However, I am concerned about potential race conditions when handling concurrent requests.

Scenario

I activate a session for Store A and start creating a product using the GraphQL API.
While the above request is in progress, I activate a session for Store B and start creating a product for that store.

Question: Could the session for Store A be mistakenly used for the request intended for Store B due to a race condition in concurrent scenarios? In other words, is there a risk of one store's session being overridden or misapplied during concurrent requests?

Additional Context

I am aware that the activate_session method sets the session globally. My concern is whether concurrent operations might lead to session conflicts, where one thread might use the session intended for another.

If this is a known issue, are there recommended practices for managing sessions in a multi-threaded or concurrent environment to avoid such conflicts?

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

No branches or pull requests

1 participant