-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(BSR)[API] fix: Fix non-thread safe usage of boto3 client in outscale…
… connector `boto3.client()` is not thread-safe. We sometimes get the following error: KeyError: 'default_config_resolver' File "pcapi/tasks/ubble_tasks.py", line 23, in store_id_pictures_task ubble_subscription_api.archive_ubble_user_id_pictures(payload.identification_id) [...] File "pcapi/connectors/beneficiaries/outscale.py", line 13, in upload_file client = boto3.client( File "__init__.py", line 92, in client return _get_default_session().client(*args, **kwargs) [...] File "botocore/session.py", line 1009, in get_component del self._deferred[name] To work around that, we now use a dedicated session. And we keep one for each thread to lessen the overhead of the session initialization. References: - discussion of the issue and possible workarounds: boto/boto3#1592 - similar fix in Sentry client code: getsentry/sentry@f58ca5e
- Loading branch information
Showing
3 changed files
with
31 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters