mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-25 06:44:25 +08:00
Merge b9968373c3d95db7abc58f2c71b8b136373a4779 into 254f6b986720c92ddf97fbb1a6a6465da8e87e29
This commit is contained in:
commit
fee1157f8f
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import enum
|
import enum
|
||||||
import time
|
import time
|
||||||
|
import weakref
|
||||||
from collections.abc import Callable, Mapping
|
from collections.abc import Callable, Mapping
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import TYPE_CHECKING, Any, Optional
|
from typing import TYPE_CHECKING, Any, Optional
|
||||||
@ -132,7 +133,9 @@ class Request:
|
|||||||
self.block_hashes: list[BlockHash] = []
|
self.block_hashes: list[BlockHash] = []
|
||||||
self.get_hash_new_full_blocks: Callable[[], list[BlockHash]] | None = None
|
self.get_hash_new_full_blocks: Callable[[], list[BlockHash]] | None = None
|
||||||
if block_hasher is not None:
|
if block_hasher is not None:
|
||||||
self.get_hash_new_full_blocks = partial(block_hasher, self)
|
# Use weakref to avoid circular reference: Request -> partial -> Request
|
||||||
|
# This allows immediate reclamation by refcounting without waiting for GC.
|
||||||
|
self.get_hash_new_full_blocks = partial(block_hasher, weakref.proxy(self))
|
||||||
self.block_hashes = self.get_hash_new_full_blocks()
|
self.block_hashes = self.get_hash_new_full_blocks()
|
||||||
|
|
||||||
self.skip_reading_prefix_cache = self.get_skip_reading_prefix_cache()
|
self.skip_reading_prefix_cache = self.get_skip_reading_prefix_cache()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user