Skip to content

Commit 30d70d2

Browse files
add max_connection_pool parameter
1 parent d7b88f0 commit 30d70d2

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

kmsauth/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
endpoint_url=None,
5858
token_cache_size=4096,
5959
stats=None,
60+
max_pool_connections=100
6061
):
6162
"""Create a KMSTokenValidator object.
6263
@@ -107,13 +108,15 @@ def __init__(
107108
aws_access_key_id=self.aws_creds['AccessKeyId'],
108109
aws_secret_access_key=self.aws_creds['SecretAccessKey'],
109110
aws_session_token=self.aws_creds['SessionToken'],
110-
endpoint_url=endpoint_url
111+
endpoint_url=endpoint_url,
112+
max_pool_connections=max_pool_connections
111113
)
112114
else:
113115
self.kms_client = kmsauth.services.get_boto_client(
114116
'kms',
115117
region=self.region,
116-
endpoint_url=endpoint_url
118+
endpoint_url=endpoint_url,
119+
max_pool_connections=max_pool_connections
117120
)
118121
if extra_context is None:
119122
self.extra_context = {}

kmsauth/services.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Module for accessing boto3 clients, resources and sessions."""
22

33
import boto3
4+
import botocore
45
import logging
56

67
CLIENT_CACHE = {}
@@ -13,7 +14,8 @@ def get_boto_client(
1314
aws_access_key_id=None,
1415
aws_secret_access_key=None,
1516
aws_session_token=None,
16-
endpoint_url=None
17+
endpoint_url=None,
18+
max_pool_connections=None
1719
):
1820
"""Get a boto3 client connection."""
1921
cache_key = '{0}:{1}:{2}:{3}'.format(
@@ -37,7 +39,10 @@ def get_boto_client(
3739

3840
CLIENT_CACHE[cache_key] = session.client(
3941
client,
40-
endpoint_url=endpoint_url
42+
endpoint_url=endpoint_url,
43+
config=botocore.config.Config(
44+
max_pool_connections=max_pool_connections
45+
)
4146
)
4247
return CLIENT_CACHE[cache_key]
4348

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from setuptools import setup, find_packages
1515

16-
VERSION = "0.6.0"
16+
VERSION = "0.6.1.dev1"
1717

1818
requirements = [
1919
# Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK)

0 commit comments

Comments
 (0)