1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: crash when running aggregation job on schedule (fix #78)

chore: move from gocron to its maintained fork
This commit is contained in:
Ferdinand Mütsch
2020-12-11 10:05:17 +01:00
parent 219e969957
commit e8067bb13e
4 changed files with 9 additions and 7 deletions

View File

@ -6,7 +6,7 @@ import (
"runtime"
"time"
"github.com/jasonlvhit/gocron"
"github.com/go-co-op/gocron"
"github.com/muety/wakapi/models"
)
@ -43,8 +43,9 @@ func (srv *AggregationService) Schedule() {
log.Fatalf("failed to run aggregation jobs: %v\n", err)
}
gocron.Every(1).Day().At(srv.config.App.AggregationTime).Do(srv.Run, nil)
<-gocron.Start()
s := gocron.NewScheduler(time.Local)
s.Every(1).Day().At(srv.config.App.AggregationTime).Do(srv.Run, map[string]bool{})
s.StartBlocking()
}
func (srv *AggregationService) Run(userIds map[string]bool) error {