You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the docs here, a Google API service should not be shared across threads because of lack of thread safety in httplib2.
The google-api-python-client library is built on top of the httplib2 library, which is not thread-safe. Therefore, if you are running as a multi-threaded application, each thread that you are making requests from must have its own instance of httplib2.Http().
The easiest way to provide threads with their own httplib2.Http() instances is to either override the construction of it within the service object or to pass an instance via the http argument to method calls.
Problematic code
In api.py, a ProcurementApi is created at the module level.
Based on the docs here, a Google API service should not be shared across threads because of lack of thread safety in
httplib2
.Problematic code
In
api.py
, a ProcurementApi is created at the module level.doit-easily-marketplace/api/api.py
Line 21 in 7b0eb8b
I believe this creates a single instance of the service, which would be shared across threads.
doit-easily-marketplace/api/procurement_api.py
Lines 20 to 24 in 7b0eb8b
For us, this has resulted in some head-scratching HTTP and SSL errors, of which I'm fairly certain this is the cause.
The text was updated successfully, but these errors were encountered: