Skip to content

Commit 778aa60

Browse files
committed
remove unneeded locks in caching classses
1 parent 4845250 commit 778aa60

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

robotcode/language_server/common/text_document.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,15 @@ async def get_cache(
217217

218218
reference = self.__get_cache_reference(entry)
219219

220-
async with self._lock:
221-
e = self._cache[reference]
220+
# async with self._lock:
221+
e = self._cache[reference]
222222

223223
async with e.lock:
224224
if not e.has_data:
225225
e.data = await entry(self, *args, **kwargs)
226226
e.has_data = True
227227

228-
return cast(_T, e.data)
228+
return cast(_T, e.data)
229229

230230
@_logger.call
231231
async def remove_cache_entry(

robotcode/utils/async_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ async def has(self, *args: Any, **kwargs: Any) -> bool:
4040
async def get(self, func: Callable[..., Awaitable[_T]], *args: Any, **kwargs: Any) -> _T:
4141
key = self._make_key(*args, **kwargs)
4242

43-
async with self.lock:
44-
entry = self._cache[key]
43+
# async with self.lock:
44+
entry = self._cache[key]
4545

4646
async with entry.lock:
4747
if not entry.has_data:

0 commit comments

Comments
 (0)