From 02157693af19b107ea8f7e7290756002da355084 Mon Sep 17 00:00:00 2001 From: "n.nakhostin" Date: Sat, 4 Oct 2025 15:25:40 +0330 Subject: [PATCH] Refactor TED Scraper Initialization in Main Application - Moved the initialization of the notification service to follow the MongoDB connection setup for better organization. - Added comments to clarify the initialization sequence of services, including the TED scraper. - Removed commented-out code related to stopping the scheduler to clean up the main function. - Enhanced the overall readability and structure of the main application entry point. --- cmd/scraper/main.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/scraper/main.go b/cmd/scraper/main.go index 4bf7395..ac77140 100644 --- a/cmd/scraper/main.go +++ b/cmd/scraper/main.go @@ -22,8 +22,6 @@ func main() { "version": "1.0.0", }) - // Initialize notification service - // Initialize MongoDB connection mongoManager := bootstrap.InitMongoDB(config.Database.MongoDB, appLogger) defer func() { @@ -36,7 +34,10 @@ func main() { } }() + // Initialize notification service notificationService := bootstrap.InitNotificationService(config.Notification, appLogger) + + // Initialize TED scraper bootstrap.InitTEDScraper(*config, mongoManager, appLogger, notificationService) // Set up signal handling for graceful shutdown @@ -47,8 +48,5 @@ func main() { <-signalChan appLogger.Info("Received shutdown signal, stopping scheduler...", map[string]interface{}{}) - // Stop the scheduler - // scheduler.Stop() - appLogger.Info("TED scraper application stopped", map[string]interface{}{}) }