1- import asyncio
21from typing import Optional
32
43from ydb import issues
@@ -12,28 +11,20 @@ def __init__(
1211 client ,
1312 name : str ,
1413 node_path : Optional [str ] = None ,
15- count : int = 1 ,
16- timeout_millis : int = 30000 ,
17- * ,
18- eventloop : Optional [asyncio .AbstractEventLoop ] = None ,
1914 ):
2015 self ._closed = False
2116 self ._name = name
22- self ._loop = eventloop or _get_shared_event_loop ()
23- self ._timeout_sec = timeout_millis / 1000.0
17+ self ._loop = _get_shared_event_loop ()
2418 self ._caller = CallFromSyncToAsync (self ._loop )
2519 self ._client = client
2620 self ._node_path = node_path
27- self ._count = count
28- self ._timeout_millis = timeout_millis
21+ self ._timeout_sec = 30
2922
3023 async def _make_lock ():
3124 return CoordinationLock (
3225 client = self ._client ,
3326 name = self ._name ,
3427 node_path = self ._node_path ,
35- count = self ._count ,
36- timeout_millis = self ._timeout_millis ,
3728 )
3829
3930 self ._async_lock : CoordinationLock = self ._caller .safe_call_with_result (_make_lock (), self ._timeout_sec )
@@ -88,14 +79,6 @@ def close(self, timeout: Optional[float] = None):
8879 return
8980 t = timeout or self ._timeout_sec
9081
91- try :
92- self ._caller .safe_call_with_result (self ._async_lock .release (), t )
93- except Exception :
94- pass
95-
96- try :
97- self ._caller .safe_call_with_result (self ._async_lock .close (True ), t )
98- except Exception :
99- pass
100-
82+ self ._caller .safe_call_with_result (self ._async_lock .release (), t )
83+ self ._caller .safe_call_with_result (self ._async_lock .close (True ), t )
10184 self ._closed = True
0 commit comments