Skip to content

Commit 9be386c

Browse files
committed
Use shorter variant of the same code
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 13b35dc commit 9be386c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/frequenz/dispatch/_actor_dispatcher.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,10 @@ async def _stop_actor(self, stopping_dispatch: Dispatch, msg: str) -> None:
275275
stopping_dispatch: The dispatch that is stopping the actor.
276276
msg: The message to be passed to the actors being stopped.
277277
"""
278-
actor: Actor | None = None
279278
identity = self._dispatch_identity(stopping_dispatch)
280279

281-
actor = self._actors.get(identity)
282-
283-
if actor:
280+
if actor := self._actors.pop(identity, None):
284281
await actor.stop(msg)
285-
286-
del self._actors[identity]
287282
else:
288283
_logger.warning(
289284
"Actor for dispatch type %r is not running", stopping_dispatch.type

0 commit comments

Comments
 (0)