Skip to content

Commit d1c9f37

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/frequenz/dispatch/_bg_service.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,13 @@ async def new_running_state_event_receiver(
184184
185185
Returns:
186186
A new receiver for running state status.
187+
188+
Raises:
189+
RuntimeError: If the dispatch service is not running.
187190
"""
191+
if not self._tasks:
192+
raise RuntimeError("Dispatch service not started")
193+
188194
# Find all matching dispatches based on the type and collect them
189195
dispatches = [
190196
dispatch for dispatch in self._dispatches.values() if dispatch.type == type

0 commit comments

Comments
 (0)