Skip to content

Commit 2c29ab7

Browse files
committed
Rename: Use start/stop dispatching terminology
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent df88828 commit 2c29ab7

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/frequenz/dispatch/_dispatcher.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def start(self) -> None:
192192
"""Start the local dispatch service."""
193193
self._bg_service.start()
194194

195-
async def manage(
195+
async def start_dispatching(
196196
self,
197197
dispatch_type: str,
198198
*,
@@ -233,6 +233,16 @@ def id_identity(dispatch: Dispatch) -> int:
233233
self._actor_dispatchers[dispatch_type] = dispatcher
234234
dispatcher.start()
235235

236+
async def stop_dispatching(self, dispatch_type: str) -> None:
237+
"""Stop managing actors for a given dispatch type.
238+
239+
Args:
240+
dispatch_type: The type of the dispatch to stop managing.
241+
"""
242+
dispatcher = self._actor_dispatchers.pop(dispatch_type, None)
243+
if dispatcher is not None:
244+
await dispatcher.stop()
245+
236246
@property
237247
def client(self) -> Client:
238248
"""Return the client."""

tests/test_mananging_actor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ async def test_manage_abstraction(
259259
generator: DispatchGenerator,
260260
strategy: MergeByIdentity | None,
261261
) -> None:
262-
"""Test Dispatcher.manage sets up correctly."""
262+
"""Test Dispatcher.start_dispatching sets up correctly."""
263263
identity: Callable[[Dispatch], int] = (
264264
strategy.identity if strategy else lambda dispatch: dispatch.id
265265
)
@@ -295,7 +295,7 @@ async def new_mock_receiver(
295295
"frequenz.dispatch._dispatcher.Dispatcher.new_running_state_event_receiver",
296296
new_mock_receiver,
297297
):
298-
await dispatcher.manage(
298+
await dispatcher.start_dispatching(
299299
dispatch_type="MANAGE_TEST",
300300
actor_factory=MockActor,
301301
merge_strategy=strategy,

0 commit comments

Comments
 (0)