Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Add pool size parameter to client constructor #534

Merged
merged 8 commits into from
Nov 17, 2017
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class InfluxDBClient(object):
:type username: str
:param password: password of the user, defaults to 'root'
:type password: str
:param pool_size: urllib3 connection pool size, defaults to 10.
:type pool_size: int
:param database: database name to connect to, defaults to None
:type database: str
:param ssl: use https instead of http to connect to InfluxDB, defaults to
Expand Down Expand Up @@ -64,6 +66,7 @@ def __init__(self,
port=8086,
username='root',
password='root',
pool_size=10,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to cast this value to an int, like we do for the port parameter in line 81.

Copy link
Contributor Author

@vaniakov vaniakov Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xginn8 makes sense.

database=None,
ssl=False,
verify_ssl=False,
Expand All @@ -87,6 +90,9 @@ def __init__(self,
self.__use_udp = use_udp
self.__udp_port = udp_port
self._session = requests.Session()
adapter = requests.adapters.HTTPAdapter(pool_connections=pool_size,
pool_maxsize=pool_size)

if use_udp:
self.udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

Expand All @@ -95,6 +101,8 @@ def __init__(self,
if ssl is True:
self._scheme = "https"

self._session.mount(self._scheme, adapter)

if proxies is None:
self._proxies = {}
else:
Expand Down