Skip to content

Commit b458df2

Browse files
committed
Make resend_latest a public attribute for Broadcast channels
This allows modifying the flag after the channel is constructed, for example in dynamically created channels. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent e32a759 commit b458df2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/frequenz/channels/_broadcast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, name: str, resend_latest: bool = False) -> None:
9090
Only used for debugging purposes.
9191
"""
9292

93-
self._resend_latest = resend_latest
93+
self.resend_latest = resend_latest
9494
"""Whether to resend the latest value to new receivers."""
9595

9696
self._recv_cv: Condition = Condition()
@@ -148,7 +148,7 @@ def new_receiver(self, name: str | None = None, maxsize: int = 50) -> Receiver[T
148148
name = str(uuid)
149149
recv: Receiver[T] = Receiver(uuid, name, maxsize, self)
150150
self._receivers[uuid] = weakref.ref(recv)
151-
if self._resend_latest and self._latest is not None:
151+
if self.resend_latest and self._latest is not None:
152152
recv.enqueue(self._latest)
153153
return recv
154154

0 commit comments

Comments
 (0)