Skip to content

Commit 225c8e5

Browse files
committed
chore: try to use a normal RLock arround aquiring an async lock part 2
1 parent 41d2cf7 commit 225c8e5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

robotcode/language_server/common/text_document.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,13 @@ def _invalidate_cache(self) -> None:
164164
self._cache.clear()
165165
create_sub_task(self.cache_invalidated(self))
166166

167-
@_logger.call
168167
def invalidate_cache(self) -> None:
169168
with self._lock:
170169
self._invalidate_cache()
171170

172171
def _invalidate_data(self) -> None:
173172
self._data.clear()
174173

175-
@_logger.call
176174
def invalidate_data(self) -> None:
177175
with self._lock:
178176
self._invalidate_data()
@@ -234,7 +232,6 @@ async def get_cache(
234232

235233
return cast(_T, e.data)
236234

237-
@_logger.call
238235
async def remove_cache_entry(
239236
self, entry: Union[Callable[[TextDocument], Awaitable[_T]], Callable[..., Awaitable[_T]]]
240237
) -> None:

robotcode/utils/async_tools.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ def aaa(fut: asyncio.Future[Any]) -> None:
471471
finally:
472472
h.cancel()
473473
finally:
474-
with self._lock:
475-
self._waiters.remove(fut)
474+
# with self._lock:
475+
self._waiters.remove(fut)
476476
except asyncio.CancelledError:
477477
# with self._lock:
478478
if not self._locked:
@@ -493,18 +493,18 @@ def release(self) -> None:
493493
self._locker = None
494494
wake_up = True
495495

496-
if wake_up:
497-
self._wake_up_first()
496+
if wake_up:
497+
self._wake_up_first()
498498

499499
def _wake_up_first(self) -> None:
500500
if not self._waiters:
501501
return
502502

503-
with self._lock:
504-
try:
505-
fut = next(iter(self._waiters))
506-
except StopIteration:
507-
return
503+
# with self._lock:
504+
try:
505+
fut = next(iter(self._waiters))
506+
except StopIteration:
507+
return
508508

509509
if fut.get_loop().is_running() and not fut.get_loop().is_closed():
510510
if fut.get_loop() == asyncio.get_running_loop():

0 commit comments

Comments
 (0)