From 5ecc3e992ae07c02d54730c89a78191fe9a2d2a4 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 13 Sep 2022 19:28:48 +0530 Subject: [PATCH] Agent: Remove send_all_events_to_island's dependency on pubsub --- .../infection_monkey/send_all_events_to_island.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/monkey/infection_monkey/send_all_events_to_island.py b/monkey/infection_monkey/send_all_events_to_island.py index b895cee72..90d009b37 100644 --- a/monkey/infection_monkey/send_all_events_to_island.py +++ b/monkey/infection_monkey/send_all_events_to_island.py @@ -6,9 +6,6 @@ from typing import Set import requests -# TODO: shouldn't leak implementation information; can we do this some other way? -from pubsub import pub - from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT from common.events import AbstractAgentEvent @@ -34,13 +31,13 @@ class send_all_events_to_island: ) self._send_to_island_thread.start() - def __call__(self, event: AbstractAgentEvent, topic=pub.AUTO_TOPIC): - topic_name = topic.getName() - self._queue.put(self._serialize_event(event, topic_name)) + def __call__(self, event: AbstractAgentEvent): + self._queue.put(self._serialize_event(event)) + logger.debug( + f"Sending event of type {type(event).__name__} to the Island at {self._server_address}" + ) - logger.debug(f"Sending event of type {topic_name} to the Island at {self._server_address}") - - def _serialize_event(self, event: AbstractAgentEvent, topic_name: str): + def _serialize_event(self, event: AbstractAgentEvent): pass class _batch_and_send_events_thread: