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

Locking session doesn't work #673

Open
AdamGold opened this issue Aug 29, 2024 · 0 comments
Open

Locking session doesn't work #673

AdamGold opened this issue Aug 29, 2024 · 0 comments

Comments

@AdamGold
Copy link

In AsyncOAuth2Client, there's self._token_refresh_lock = Lock() introduced here.

The problem is, that for every new request, a new instance of AsyncOAuth2Client is created, therefore the lock doesn't make any difference for multiple requests.

    def _get_oauth_client(self, **metadata):
        client_kwargs = {}
        client_kwargs.update(self.client_kwargs)
        client_kwargs.update(metadata)

        if self.authorize_url:
            client_kwargs['authorization_endpoint'] = self.authorize_url
        if self.access_token_url:
            client_kwargs['token_endpoint'] = self.access_token_url

        session = self.client_cls(
            client_id=self.client_id,
            client_secret=self.client_secret,
            update_token=self._on_update_token,
            **client_kwargs
        )

Am I missing something?

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