Skip to content

Commit f2f81d5

Browse files
committed
Close receiver when stopping LatestValueCache
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
1 parent 9797c28 commit f2f81d5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/frequenz/channels/_latest_value_cache.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class LatestValueCache(typing.Generic[T_co]):
5353
5454
It provides a way to look up the latest value in a stream without any delay,
5555
as long as there has been one value received.
56+
57+
Takes ownership of the receiver. When the cache is stopped, the receiver
58+
will be closed.
5659
"""
5760

5861
def __init__(
@@ -109,6 +112,7 @@ async def _run(self) -> None:
109112

110113
async def stop(self) -> None:
111114
"""Stop the cache."""
115+
self._receiver.close()
112116
if not self._task.done():
113117
self._task.cancel()
114118
try:

0 commit comments

Comments
 (0)