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.
This commit is contained in:
+3
-5
@@ -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{}{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user