Skip to content

Commit 32999c0

Browse files
committed
Handle asyncio.CancelledError separately in the LogicalMeter
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent ecbe542 commit 32999c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/frequenz/sdk/timeseries/logical_meter/_logical_meter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ async def _run_formula(
7777
while True:
7878
try:
7979
msg = await formula.apply()
80-
await sender.send(msg)
80+
except asyncio.CancelledError:
81+
logger.exception("LogicalMeter task cancelled")
82+
break
8183
except Exception as err: # pylint: disable=broad-except
8284
logger.warning("Formula application failed: %s", err)
85+
else:
86+
await sender.send(msg)
8387

8488
async def start_formula(
8589
self,

0 commit comments

Comments
 (0)