Skip to content

Commit 2c731e3

Browse files
committed
Raise when trying to create a receiver while disconnected
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 183b7f4 commit 2c731e3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/frequenz/dispatch/_bg_service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,12 @@ async def new_running_state_event_receiver(
186186
187187
Returns:
188188
A new receiver for running state status.
189+
190+
Raises:
191+
RuntimeError: If the dispatch service is not running.
189192
"""
193+
if not self.is_running:
194+
raise RuntimeError("Dispatch service not started")
190195

191196
# Wait with timeout for the initial fetch to complete
192197
await asyncio.wait_for(

0 commit comments

Comments
 (0)