Skip to content

Commit

Permalink
perf(compat): reuse SSLContext as aiohttp does
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Nov 6, 2023
1 parent 2e22ac5 commit 56660b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ async def __aexit__(self, exc_type, exc_value, traceback):
)


# Reuse SSLContext as aiohttp does:
# https://github.com/aio-libs/aiohttp/blob/b51610b93b2ae15c4062e3a1680a536ba5f4c5c4/aiohttp/connector.py#L906
@functools.lru_cache(None)
def ssl_create_default_context():
"""`ssl.create_default_context`"""
context = ssl.create_default_context()
Expand Down

0 comments on commit 56660b8

Please sign in to comment.