Island: Simplify logic in island_event_handlers._subscribe_clear_simulation_data_events

This commit is contained in:
Shreya Malviya 2022-09-20 17:05:53 +05:30
parent f93565b2cf
commit 638e4cd7ed
1 changed files with 8 additions and 13 deletions

View File

@ -39,16 +39,11 @@ def _subscribe_clear_simulation_data_events(
IslandEventTopic.CLEAR_SIMULATION_DATA, credentials_repository.remove_stolen_credentials
)
node_repository = container.resolve(INodeRepository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, node_repository.reset)
agent_event_repository = container.resolve(IAgentEventRepository)
island_event_queue.subscribe(
IslandEventTopic.CLEAR_SIMULATION_DATA, agent_event_repository.reset
)
agent_repository = container.resolve(IAgentRepository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, agent_repository.reset)
machine_repository = container.resolve(IMachineRepository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, machine_repository.reset)
for i_repository in [
INodeRepository,
IAgentEventRepository,
IAgentRepository,
IMachineRepository,
]:
repository = container.resolve(i_repository)
island_event_queue.subscribe(IslandEventTopic.CLEAR_SIMULATION_DATA, repository.reset)