From 9d1060d8f4fc7584cabd6e2e791331bccf02cdbe Mon Sep 17 00:00:00 2001 From: Mazyar Date: Sun, 28 Dec 2025 16:41:04 +0330 Subject: [PATCH] worker log --- cmd/worker/bootstrap/bootstrap.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/worker/bootstrap/bootstrap.go b/cmd/worker/bootstrap/bootstrap.go index f37f58b..ce30b69 100644 --- a/cmd/worker/bootstrap/bootstrap.go +++ b/cmd/worker/bootstrap/bootstrap.go @@ -78,6 +78,10 @@ func InitMongoDB(conf config.MongoConfig, log logger.Logger) *mongo.ConnectionMa // Init Worker func InitWorker(config Config, mongoManager *mongo.ConnectionManager, appLogger logger.Logger, notify notification.SDK, glmService *glm.SDK, scraperService scraper.SDK, minioService *minio.Service) { + // Debug: Log worker config + appLogger.Info("Worker configuration", map[string]interface{}{ + "worker_interval": config.Worker.Interval, + }) // Initialize repositories noticeRepo := notice.NewRepository(mongoManager, appLogger) tenderRepo := tender.NewRepository(mongoManager, appLogger) @@ -113,13 +117,21 @@ func InitWorker(config Config, mongoManager *mongo.ConnectionManager, appLogger } // Schedule Notice Worker job + workerInterval := config.Worker.Interval + if workerInterval == "" { + workerInterval = "* 10 * * * *" // Default: every hour at minute 10 + appLogger.Warn("WORKER_INTERVAL not set, using default schedule", map[string]interface{}{ + "interval": workerInterval, + }) + } + schedule.NewCronScheduler(appLogger, mongoManager, noticeRepo).AddJob(schedule.Job{ Name: "Notice Worker Job", Func: func() { worker := workers.NewNoticeWorker(mongoManager, appLogger, ¬ify, noticeRepo, tenderRepo, glmService, scraperService) worker.Run() }, - Expr: config.Worker.Interval, + Expr: workerInterval, }) // Schedule Document Scraper Worker job (runs after notice worker)