updating the cron
This commit is contained in:
parent
386965ea4e
commit
83b0c3e07f
|
|
@ -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
|
||||
// }
|
||||
|
||||
|
|
|
|||
|
|
@ -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...")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user