Skip to content

Commit e468e9f

Browse files
committed
Explicitly check if the event loop is running in the while loop condition
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 7a27b75 commit e468e9f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/frequenz/sdk/microgrid/_power_distributing/_component_status/_battery_status_tracker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ async def _run(
262262
inverter = inverter_receiver
263263
set_power_result = set_power_result_receiver
264264

265-
while True:
265+
# To prevent entering a shutdown-loop, we explicitly check if there is
266+
# an eventloop running
267+
while asyncio.get_event_loop().is_running():
266268
try:
267269
async for selected in select(
268270
battery,

0 commit comments

Comments
 (0)