From 4eabf6e77b5bc27b9201bb4c38767ddacd675a15 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 14 Sep 2022 19:45:12 +0530 Subject: [PATCH] Agent: Use create_daemon_thread() instead of threading.Thread() in AgentEventsToIslandSender --- monkey/infection_monkey/send_all_events_to_island.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/send_all_events_to_island.py b/monkey/infection_monkey/send_all_events_to_island.py index 3bdb08db9..479e5bbe5 100644 --- a/monkey/infection_monkey/send_all_events_to_island.py +++ b/monkey/infection_monkey/send_all_events_to_island.py @@ -9,6 +9,7 @@ from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT from common.event_serializers import EventSerializerRegistry from common.event_serializers.i_event_serializer import JSONSerializable from common.events import AbstractAgentEvent +from infection_monkey.utils.threading import create_daemon_thread logger = logging.getLogger(__name__) @@ -59,8 +60,8 @@ class AgentEventsToIslandSender: self._stop_batch_and_send_thread = threading.Event() def start(self): - self._batch_and_send_thread = threading.Thread( - name="SendEventsToIslandInBatchesThread", target=self._manage_event_batches + self._batch_and_send_thread = create_daemon_thread( + target=self._manage_event_batches, name="SendEventsToIslandInBatchesThread" ) self._batch_and_send_thread.start()