Skip to content

Commit f315f0f

Browse files
committed
Add GrpcStreamBroadcaster.is_running method
Based on how it is configured, the `GrpcStreamBroadcaster` can stop running when the retry limit has been reached or when the server closes the connection. The `is_running` method can be used to find out if that has happened. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent b4c1883 commit f315f0f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/frequenz/client/base/streaming.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ def new_receiver(self, maxsize: int = 50) -> channels.Receiver[OutputT]:
7171
"""
7272
return self._channel.new_receiver(limit=maxsize)
7373

74+
@property
75+
def is_running(self) -> bool:
76+
"""Return whether the streaming helper is running.
77+
78+
Returns:
79+
Whether the streaming helper is running.
80+
"""
81+
return not self._task.done()
82+
7483
async def stop(self) -> None:
7584
"""Stop the streaming helper."""
7685
if self._task.done():

0 commit comments

Comments
 (0)