chore: Updated version to v1.0.3

- Uncommented event service Crons
This commit is contained in:
Samuel Tariku 2025-11-01 23:34:54 +03:00
parent b90dc516be
commit e66ef8a740
2 changed files with 100 additions and 100 deletions

View File

@ -37,108 +37,108 @@ func StartBetAPIDataFetchingCrons(
spec string spec string
task func() task func()
}{ }{
// { {
// spec: "0 0 * * * *", // Every 1 hour spec: "0 0 * * * *", // Every 1 hour
// task: func() { task: func() {
// start := time.Now() start := time.Now()
// mongoLogger.Info("[BetAPI Event Fetching Crons] Began fetching upcoming events cron task", zap.Time("timestamp", time.Now())) mongoLogger.Info("[BetAPI Event Fetching Crons] Began fetching upcoming events cron task", zap.Time("timestamp", time.Now()))
// if err := eventService.FetchUpcomingEvents(context.Background()); err != nil { if err := eventService.FetchUpcomingEvents(context.Background()); err != nil {
// mongoLogger.Error("[BetAPI Event Fetching Crons] Failed to fetch upcoming events", mongoLogger.Error("[BetAPI Event Fetching Crons] Failed to fetch upcoming events",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// zap.Error(err), zap.Error(err),
// ) )
// } else { } else {
// mongoLogger.Info("[BetAPI Event Fetching Crons] Completed fetching upcoming events without errors", mongoLogger.Info("[BetAPI Event Fetching Crons] Completed fetching upcoming events without errors",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } }
// }, },
// }, },
// { {
// spec: "0 0 * * * *", // Every 1 hour (since its takes that long to fetch all the events) spec: "0 0 * * * *", // Every 1 hour (since its takes that long to fetch all the events)
// task: func() { task: func() {
// start := time.Now() start := time.Now()
// mongoLogger.Info("[BetAPI Pre-Match Odds Fetching Crons] Began fetching pre-match odds cron task", mongoLogger.Info("[BetAPI Pre-Match Odds Fetching Crons] Began fetching pre-match odds cron task",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// ) )
// if err := oddsService.FetchNonLiveOdds(context.Background()); err != nil { if err := oddsService.FetchNonLiveOdds(context.Background()); err != nil {
// mongoLogger.Error("[BetAPI Pre-Match Odds Fetching Crons] Failed to fetch pre-match odds", mongoLogger.Error("[BetAPI Pre-Match Odds Fetching Crons] Failed to fetch pre-match odds",
// zap.Error(err), zap.Error(err),
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } else { } else {
// mongoLogger.Info("[BetAPI Pre-Match Odds Fetching Crons] Completed fetching pre-match odds without errors", mongoLogger.Info("[BetAPI Pre-Match Odds Fetching Crons] Completed fetching pre-match odds without errors",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } }
// }, },
// }, },
// { {
// spec: "0 */5 * * * *", // Every 5 Minutes spec: "0 */5 * * * *", // Every 5 Minutes
// task: func() { task: func() {
// start := time.Now() start := time.Now()
// mongoLogger.Info("[BetAPI Check And Update Expired Events Crons] Began update all expired events status cron task", mongoLogger.Info("[BetAPI Check And Update Expired Events Crons] Began update all expired events status cron task",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// ) )
// if _, err := resultService.CheckAndUpdateExpiredB365Events(context.Background()); err != nil { if _, err := resultService.CheckAndUpdateExpiredB365Events(context.Background()); err != nil {
// mongoLogger.Error("[BetAPI Check And Update Expired Events Crons] Failed to update expired events status", mongoLogger.Error("[BetAPI Check And Update Expired Events Crons] Failed to update expired events status",
// zap.Error(err), zap.Error(err),
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } else { } else {
// mongoLogger.Info("[BetAPI Check And Update Expired Events Crons] Completed expired events without errors", mongoLogger.Info("[BetAPI Check And Update Expired Events Crons] Completed expired events without errors",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } }
// }, },
// }, },
// { {
// spec: "0 */15 * * * *", // Every 15 Minutes spec: "0 */15 * * * *", // Every 15 Minutes
// task: func() { task: func() {
// start := time.Now() start := time.Now()
// mongoLogger.Info("[BetAPI Fetch Result and Update Bets Crons] Began updating bets based on event results cron task") mongoLogger.Info("[BetAPI Fetch Result and Update Bets Crons] Began updating bets based on event results cron task")
// if err := resultService.FetchB365ResultAndUpdateBets(context.Background()); err != nil { if err := resultService.FetchB365ResultAndUpdateBets(context.Background()); err != nil {
// mongoLogger.Error("[BetAPI Fetch Result and Update Bets Crons] Failed to process result", mongoLogger.Error("[BetAPI Fetch Result and Update Bets Crons] Failed to process result",
// zap.Error(err), zap.Error(err),
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } else { } else {
// mongoLogger.Info("[BetAPI Fetch Result and Update Bets Crons] Completed processing all event result outcomes without errors", mongoLogger.Info("[BetAPI Fetch Result and Update Bets Crons] Completed processing all event result outcomes without errors",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Duration("duration", time.Since(start)), zap.Duration("duration", time.Since(start)),
// ) )
// } }
// }, },
// }, },
// { {
// spec: "0 0 0 * * 1", // Every Monday spec: "0 0 0 * * 1", // Every Monday
// task: func() { task: func() {
// mongoLogger.Info("[BetAPI Send Result Notification Crons] Began Send weekly result notification cron task", mongoLogger.Info("[BetAPI Send Result Notification Crons] Began Send weekly result notification cron task",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// ) )
// if err := resultService.CheckAndSendResultNotifications(context.Background(), time.Now().Add(-7*24*time.Hour)); err != nil { if err := resultService.CheckAndSendResultNotifications(context.Background(), time.Now().Add(-7*24*time.Hour)); err != nil {
// mongoLogger.Error("[BetAPI Send Result Notification Crons] Failed to process result", mongoLogger.Error("[BetAPI Send Result Notification Crons] Failed to process result",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// zap.Error(err), zap.Error(err),
// ) )
// } else { } else {
// mongoLogger.Info("[BetAPI Send Result Notification Crons] Completed sending weekly result notification without errors", mongoLogger.Info("[BetAPI Send Result Notification Crons] Completed sending weekly result notification without errors",
// zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),
// ) )
// } }
// }, },
// }, },
} }
for _, job := range schedule { for _, job := range schedule {
job.task() // job.task()
if _, err := c.AddFunc(job.spec, job.task); err != nil { if _, err := c.AddFunc(job.spec, job.task); err != nil {
mongoLogger.Error("[BetAPI Data Fetching Crons] Failed to schedule data fetching cron job", mongoLogger.Error("[BetAPI Data Fetching Crons] Failed to schedule data fetching cron job",
zap.Time("timestamp", time.Now()), zap.Time("timestamp", time.Now()),

View File

@ -62,7 +62,7 @@ func (a *App) initAppRoutes() {
a.fiber.Get("/", func(c *fiber.Ctx) error { a.fiber.Get("/", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{ return c.JSON(fiber.Map{
"message": "Welcome to the FortuneBet API", "message": "Welcome to the FortuneBet API",
"version": "1.0.2", "version": "1.0.3",
}) })
}) })