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 all 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
10 changes: 10 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 @@ -72,6 +74,7 @@ def __init__(self,
use_udp=False,
udp_port=4444,
proxies=None,
pool_size=10,
):
"""Construct a new InfluxDBClient object."""
self.__host = host
Expand All @@ -87,6 +90,11 @@ def __init__(self,
self.__use_udp = use_udp
self.__udp_port = udp_port
self._session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
pool_connections=int(pool_size),
pool_maxsize=int(pool_size)
)

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

Expand All @@ -95,6 +103,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