Skip to content

Commit 3985408

Browse files
authored
Fix handling of unexpected exceptions in GrpcStreamBroadcaster (frequenz-floss#143)
`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.
2 parents 0e963b9 + 28ee574 commit 3985408

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

RELEASE_NOTES.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Features
44

5-
* Added support for HMAC signing of UnaryUnary client messages
6-
* Added support for HMAC signing of UnaryStream client messages
5+
* Added support for HMAC signing of `UnaryUnary` client messages
6+
* Added support for HMAC signing of `UnaryStream` client messages
77

88
## Upgrading
99

@@ -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)