feat: add database #7
1 changed files with 16 additions and 0 deletions
|
@ -3,6 +3,7 @@ package router
|
|||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-co-op/gocron/v2"
|
||||
|
||||
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/app"
|
||||
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/controllers/taskcontroller"
|
||||
|
@ -32,6 +33,21 @@ func (r *Router) Setup() *chi.Mux {
|
|||
repoService := reposervice.New(r.app)
|
||||
repoService.ForceUpdate()
|
||||
|
||||
s, _ := gocron.NewScheduler()
|
||||
defer func() { _ = s.Shutdown() }()
|
||||
|
||||
_, _ = s.NewJob(
|
||||
gocron.CronJob(
|
||||
"0 4 * * *",
|
||||
false,
|
||||
),
|
||||
gocron.NewTask(
|
||||
func() {
|
||||
repoService.ForceUpdate()
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
taskController := taskcontroller.New(
|
||||
r.app,
|
||||
taskService,
|
||||
|
|
Loading…
Reference in a new issue