Skip to content

Commit

Permalink
aws_iot_logger: move create_log_group from __init__ to thread_main
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Mar 4, 2024
1 parent 82c22da commit 5b07231
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/otaclient_iot_logging_server/aws_iot_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ def __init__(
# will definitely have entries less than MAX_LOGS_PER_PUT
self._max_logs_per_merge = min(max_logs_per_merge, self.MAX_LOGS_PER_PUT)

# unconditionally create log_group and log_stream, do nothing if existed.
self._create_log_group()

@retry(max_retry=16, backoff_factor=2, backoff_max=32)
def _create_log_group(self):
# TODO: (20240214) should we let the edge side iot_logging_server
Expand Down Expand Up @@ -181,6 +178,9 @@ def send_messages(self, log_stream_name: str, message_list: list[LogMessage]):

def thread_main(self) -> NoReturn:
"""Main entry for running this iot_logger in a thread."""
# unconditionally create log_group and log_stream, do nothing if existed.
self._create_log_group()

while True:
# merge LogMessages into the same source, identified by
# log_stream_suffix.
Expand Down

0 comments on commit 5b07231

Please sign in to comment.