We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
LatestValueCache
1 parent 9797c28 commit 08662b9Copy full SHA for 08662b9
1 file changed
src/frequenz/channels/_latest_value_cache.py
@@ -53,6 +53,9 @@ class LatestValueCache(typing.Generic[T_co]):
53
54
It provides a way to look up the latest value in a stream without any delay,
55
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.
59
"""
60
61
def __init__(
@@ -108,7 +111,8 @@ async def _run(self) -> None:
108
111
self._latest_value = value
109
112
110
113
async def stop(self) -> None:
- """Stop the cache."""
114
+ """Stop the cache and close the owned receiver."""
115
+ self._receiver.close()
116
if not self._task.done():
117
self._task.cancel()
118
try:
0 commit comments