Update src/petals/server/memory_cache.py

Co-authored-by: Alexander Borzunov <borzunov.alexander@gmail.com>
pull/434/head
justheuristic 10 months ago committed by GitHub
parent 9809b0ad37
commit 7f118e8547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -124,7 +124,7 @@ class MemoryCache:
"""
try:
async with self._wait_for_free_memory(alloc_size, timeout):
async with enter_asynchronously(self._lock_metadata):
with self._lock_metadata:
handles = tuple(int(self.handle_counter) + i for i in range(len(descriptors)))
self.current_size_bytes += alloc_size
self.handle_counter += len(handles) # note: this will eventually overflow and it is okay

Loading…
Cancel
Save