-
Notifications
You must be signed in to change notification settings - Fork 524
Add pool size parameter to client constructor #534
Conversation
influxdb/client.py
Outdated
@@ -64,6 +66,7 @@ def __init__(self, | |||
port=8086, | |||
username='root', | |||
password='root', | |||
pool_size=10, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xginn8 makes sense.
@xginn8 nice catch! |
thanks for contributing! |
Hi all, sorry but I find this issue is still exist in the master branch, the parameter pool_size is invalid even we added it to __init__ method. I think that influxdb-python/influxdb/client.py Line 106 in 35732cd
self._session.mount(self._scheme+'://', adapter) ",because after executing this line, the "session.adapters" will have three members: " OrderedDict([('https://', <requests.adapters.HTTPAdapter object at 0x7f0c9c123890>), ('http://', <requests.adapters.HTTPAdapter object at 0x7f0c9404e190>), ('http', <requests.adapters.HTTPAdapter object at 0x7f0c9e874290>)])) ", the https:// and http:// adapters are added here https://github.com/requests/requests/blob/3dc84cde5b785a85cb20eb2f0d4530fd568a6af7/requests/sessions.py#L391-L393 while initializing, and when you execute https://github.com/requests/requests/blob/3dc84cde5b785a85cb20eb2f0d4530fd568a6af7/requests/sessions.py#L691, you want to get the adapter 'http' which is mounted at influxdb-python/influxdb/client.py Line 106 in 35732cd
So while we write_points to influxdb, we still use the default pool_size=10, then we run into issue #349. If we add '://' to Sorry but I am a newbee of github, cc @xginn8 @vaniakov for notification this comment. |
@hppylbb you are correct. Working on the new PR. |
This pull request relates to the issue Connection pool is full, discarding connection. To reproduce it you need to create more than 10 (default size of the urllib3 connection pool) simultaneous connection to the database from the same client object.