From aa5103c8b9a8b1c0ee24f31954bfb0f2b35993b3 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby Date: Wed, 6 Jul 2016 10:04:54 +0200 Subject: [PATCH] in Multithreaded environment we need to increase number of connections maxsize=2, block=True After all it's just a warning ("Connection pool is full, discarding connection: intake.opbeat.com") when a connection that was created after "maxsize" have been used will not be put back into the pool. We can use block=True here instead, since we're async. --- opbeat_python_urllib3/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opbeat_python_urllib3/__init__.py b/opbeat_python_urllib3/__init__.py index 85babcb..34b6aff 100644 --- a/opbeat_python_urllib3/__init__.py +++ b/opbeat_python_urllib3/__init__.py @@ -61,6 +61,12 @@ def send(self, data, headers, timeout=None): class AsyncUrllib3Transport(AsyncHTTPTransport, Urllib3Transport): scheme = ['http', 'https'] async_mode = True + http = urllib3.PoolManager( + cert_reqs='CERT_REQUIRED' if ca_certs else 'CERT_NONE', + ca_certs=ca_certs, + maxsize=2, + block=True, + ) def send_sync(self, data=None, headers=None, success_callback=None, fail_callback=None):