44
55 No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
66
7- OpenAPI spec version: v1.13.1
7+ OpenAPI spec version: v1.13.4
88
99 Generated by: https://github.com/swagger-api/swagger-codegen.git
1010"""
@@ -58,13 +58,15 @@ class ApiClient(object):
5858 'datetime' : datetime ,
5959 'object' : object ,
6060 }
61+ _pool = None
6162
62- def __init__ (self , configuration = None , header_name = None , header_value = None , cookie = None ):
63+ def __init__ (self , configuration = None , header_name = None , header_value = None ,
64+ cookie = None , pool_threads = None ):
6365 if configuration is None :
6466 configuration = Configuration ()
6567 self .configuration = configuration
68+ self .pool_threads = pool_threads
6669
67- self .pool = ThreadPool ()
6870 self .rest_client = RESTClientObject (configuration )
6971 self .default_headers = {}
7072 if header_name is not None :
@@ -74,8 +76,19 @@ def __init__(self, configuration=None, header_name=None, header_value=None, cook
7476 self .user_agent = 'Swagger-Codegen/9.0.0-snapshot/python'
7577
7678 def __del__ (self ):
77- self .pool .close ()
78- self .pool .join ()
79+ if self ._pool :
80+ self ._pool .close ()
81+ self ._pool .join ()
82+ self ._pool = None
83+
84+ @property
85+ def pool (self ):
86+ """Create thread pool on first request
87+ avoids instantiating unused threadpool for blocking clients.
88+ """
89+ if self ._pool is None :
90+ self ._pool = ThreadPool (self .pool_threads )
91+ return self ._pool
7992
8093 @property
8194 def user_agent (self ):
0 commit comments