From 9a066146a1e3987e00bca5242eebe6450adf94a0 Mon Sep 17 00:00:00 2001 From: Nejc Date: Wed, 5 Jan 2022 10:00:39 +0100 Subject: [PATCH] Bugfix for OSError: [Errno 24] Too many open files Close multiprocessing.Pool when closing RestClient. When opening RestClient multiple times you get error: "OSError: [Errno 24] Too many open files", which is caused because Pool's are not closing automatically. This commit fixes that. --- sdk/request_utils/rest_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/request_utils/rest_client.py b/sdk/request_utils/rest_client.py index 2cf3a70..5fa670d 100644 --- a/sdk/request_utils/rest_client.py +++ b/sdk/request_utils/rest_client.py @@ -122,9 +122,10 @@ def start(self, n: int = 3): def stop(self): """ - Stop rest client immediately. + Stop rest client immediately and close pools. """ self._active = False + self._pool.close() def join(self): """