updating the cron

This commit is contained in:
Samuel Tariku 2025-04-28 21:03:06 +03:00
parent 386965ea4e
commit 83b0c3e07f
2 changed files with 8 additions and 4 deletions

View File

@ -101,8 +101,8 @@ func (s *service) FetchUpcomingEvents(ctx context.Context) error {
sportIDs := []int{1}
var totalPages int = 1
var page int = 0
// var limit int = 5
// var count int = 0
var limit int = 5
var count int = 0
for _, sportID := range sportIDs {
for page != totalPages {
page = page + 1
@ -171,6 +171,11 @@ func (s *service) FetchUpcomingEvents(ctx context.Context) error {
_ = s.store.SaveUpcomingEvent(ctx, event)
}
totalPages = data.Pager.Total
if count > limit {
break
}
count++
}
}
@ -236,4 +241,3 @@ func (s *service) GetUpcomingEventByID(ctx context.Context, ID string) (domain.U
// return nil
// }

View File

@ -43,7 +43,7 @@ func StartDataFetchingCrons(eventService eventsvc.Service, oddsService oddssvc.S
},
},
{
spec: "*/10 * * * * *",
spec: "0 */15 * * * *",
task: func() {
log.Println("Fetching results for upcoming events...")