|
4 | 4 |
|
5 | 5 | No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) |
6 | 6 |
|
7 | | - OpenAPI spec version: v1.13.1 |
| 7 | + OpenAPI spec version: v1.13.2 |
8 | 8 | |
9 | 9 | Generated by: https://github.com/swagger-api/swagger-codegen.git |
10 | 10 | """ |
@@ -58,24 +58,37 @@ class ApiClient(object): |
58 | 58 | 'datetime': datetime, |
59 | 59 | 'object': object, |
60 | 60 | } |
| 61 | + _pool = None |
61 | 62 |
|
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): |
63 | 65 | if configuration is None: |
64 | 66 | configuration = Configuration() |
65 | 67 | self.configuration = configuration |
| 68 | + self.pool_threads = pool_threads |
66 | 69 |
|
67 | | - self.pool = ThreadPool() |
68 | 70 | self.rest_client = RESTClientObject(configuration) |
69 | 71 | self.default_headers = {} |
70 | 72 | if header_name is not None: |
71 | 73 | self.default_headers[header_name] = header_value |
72 | 74 | self.cookie = cookie |
73 | 75 | # Set default User-Agent. |
74 | | - self.user_agent = 'Swagger-Codegen/9.0.0-snapshot/python' |
| 76 | + self.user_agent = 'Swagger-Codegen/9.0.0a1/python' |
75 | 77 |
|
76 | 78 | 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 |
79 | 92 |
|
80 | 93 | @property |
81 | 94 | def user_agent(self): |
|
0 commit comments