SIENTIAPDE-1325

Refactor initialization of Activities, Gates, and MongoDB classes for improved readability by using multi-line argument formatting. Update related tests to match the new initialization style.
This commit is contained in:
vitor-aignosi
2025-10-30 16:50:39 -03:00
parent d4a74ec5eb
commit 8350a3a0c3
9 changed files with 71 additions and 35 deletions

View File

@@ -83,7 +83,12 @@ class Activities(Postgres, Redis, Gates, MongoDB):
)
# Initialize Gates
Gates.__init__(self, logger=logger, notification_handler=notification_handler, metrics_controller=metrics_controller)
Gates.__init__(
self,
logger=logger,
notification_handler=notification_handler,
metrics_controller=metrics_controller,
)
# Initialize MongoDB
MongoDB.__init__(

View File

@@ -37,7 +37,12 @@ class Gates(SientiaMonitoring):
ensure data integrity and enable flexible data processing workflows.
"""
def __init__(self, logger: Logger, notification_handler: NotificationHandler, metrics_controller: MetricsController):
def __init__(
self,
logger: Logger,
notification_handler: NotificationHandler,
metrics_controller: MetricsController,
):
"""
Initialize the Gates class with logging and notification services.

View File

@@ -60,7 +60,12 @@ class MongoDB(SientiaMonitoring):
metrics_controller=metrics_controller,
)
SientiaMonitoring.__init__(self, logger=logger, notification_handler=notification_handler, metrics_controller=metrics_controller)
SientiaMonitoring.__init__(
self,
logger=logger,
notification_handler=notification_handler,
metrics_controller=metrics_controller,
)
def close(self):
"""

View File

@@ -134,10 +134,8 @@ async def main():
try:
await asyncio.gather(*handlers)
except BaseException as e: # NOSONAR
logger.custom_error(
'An unhandled exception occurred: %s', metadata=metadata
)
except BaseException: # NOSONAR
logger.custom_error('An unhandled exception occurred: %s', metadata=metadata)
finally:
if notification_handler:
notification_handler.shutdown()