From 233d969698447b3e1ac0a4d244ac3bc2d679071a Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Tue, 3 Mar 2020 12:39:12 +0100 Subject: [PATCH] fix: Correctly close connection pool manager at exit --- CHANGELOG.md | 1 + influxdb_client/api_client.py | 2 ++ openapi-generator/src/main/resources/python/api_client.mustache | 2 ++ 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b8a8568..61908986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bugs 1. [#61](https://github.com/influxdata/influxdb-client-python/issues/61): Correctly parse CSV where multiple results include multiple tables +1. [#66](https://github.com/influxdata/influxdb-client-python/issues/66): Correctly close connection pool manager at exit ## 1.4.0 [2020-02-14] diff --git a/influxdb_client/api_client.py b/influxdb_client/api_client.py index 808d8b96..0ff8bfe4 100644 --- a/influxdb_client/api_client.py +++ b/influxdb_client/api_client.py @@ -82,6 +82,8 @@ def __del__(self): self._pool.close() self._pool.join() self._pool = None + if self.rest_client and self.rest_client.pool_manager and hasattr(self.rest_client.pool_manager, 'clear'): + self.rest_client.pool_manager.clear() @property def pool(self): diff --git a/openapi-generator/src/main/resources/python/api_client.mustache b/openapi-generator/src/main/resources/python/api_client.mustache index 8d48c141..5a9119df 100644 --- a/openapi-generator/src/main/resources/python/api_client.mustache +++ b/openapi-generator/src/main/resources/python/api_client.mustache @@ -77,6 +77,8 @@ class ApiClient(object): self._pool.close() self._pool.join() self._pool = None + if self.rest_client and self.rest_client.pool_manager and hasattr(self.rest_client.pool_manager, 'clear'): + self.rest_client.pool_manager.clear() @property def pool(self):