Skip to content

Commit 96c0ff1

Browse files
committed
also driver
1 parent 2d5bfdf commit 96c0ff1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ydb/driver.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from . import tracing
99
from . import iam
1010
from . import _utilities
11+
from .coordination.client import CoordinationClient
12+
1113

1214

1315
logger = logging.getLogger(__name__)
@@ -248,7 +250,7 @@ def get_config(
248250

249251

250252
class Driver(pool.ConnectionPool):
251-
__slots__ = ("scheme_client", "table_client")
253+
__slots__ = ("scheme_client", "table_client", "coordination_client")
252254

253255
def __init__(
254256
self,
@@ -287,10 +289,16 @@ def __init__(
287289
self._credentials = driver_config.credentials
288290

289291
self.scheme_client = scheme.SchemeClient(self)
292+
self.coordination_client = CoordinationClient(self)
290293
self.table_client = table.TableClient(self, driver_config.table_client_settings)
291294
self.topic_client = topic.TopicClient(self, driver_config.topic_client_settings)
292295

293296
def stop(self, timeout=10):
294297
self.table_client._stop_pool_if_needed(timeout=timeout)
295298
self.topic_client.close()
299+
if hasattr(self, "coordination_client"):
300+
try:
301+
self.coordination_client.close()
302+
except Exception as e:
303+
logger.warning(f"Failed to close coordination client: {e}")
296304
super().stop(timeout=timeout)

0 commit comments

Comments
 (0)