Skip to content

Commit 831fb33

Browse files
committed
Fix handling of unexpected exceptions in GrpcStreamBroadcaster
`GrpcStreamBroadcaster` will now correctly try to restart on unexpected errors. Before if an unexpected exception was raised by the stream method, the internal task would silently finish and never start again. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 0e963b9 commit 831fb33

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
## Bug Fixes
1515

1616
* Fixed keys of signature to match what fuse-rs expects
17+
* `GrpcStreamBroadcaster` will now correctly try to restart on unexpected errors.
18+
19+
Before if an unexpected exception was raised by the stream method, the
20+
internal task would silently finish and never start again.

src/frequenz/client/base/streaming.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ async def _run(self) -> None:
111111
await sender.send(self._transform(msg))
112112
except grpc.aio.AioRpcError as err:
113113
error = err
114+
except Exception as err: # pylint: disable=broad-except
115+
_logger.exception(
116+
"%s: raise an unexpected exception",
117+
self._stream_name,
118+
)
119+
error = err
114120
if error is None and not self._retry_on_exhausted_stream:
115121
_logger.info(
116122
"%s: connection closed, stream exhausted", self._stream_name

0 commit comments

Comments
 (0)