Skip to content

Commit 1f1c031

Browse files
committed
chore: update httpclient
1 parent 73a1e2b commit 1f1c031

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

tests/unit/http/test_http_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ def test_session_not_preserved(self):
292292
self.assertEqual(response_1.content, "response_1")
293293
self.assertEqual(response_2.content, "response_2")
294294

295+
def test_session_max_retries(self):
296+
client = TwilioHttpClient(max_retries=10)
297+
self.assertEqual(10, client.session.get_adapter("https://").max_retries.total)
298+
client = TwilioHttpClient()
299+
self.assertEqual(12, client.session.get_adapter("https://").poolmanager.connection_pool_kw['maxsize'])
300+
301+
295302

296303
class MyVersion(Version):
297304
def __init__(self, domain):

twilio/http/http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(
4040
self.session = Session() if pool_connections else None
4141
if self.session and max_retries is not None:
4242
self.session.mount("https://", HTTPAdapter(max_retries=max_retries))
43-
if self.session is not None:
43+
elif self.session is not None:
4444
self.session.mount(
4545
"https://", HTTPAdapter(pool_maxsize=min(32, os.cpu_count() + 4))
4646
)

0 commit comments

Comments
 (0)