feat/add-database #8

Merged
maks1ms merged 9 commits from feat/add-database into main 2024-12-14 08:40:46 +00:00
Showing only changes of commit f2ef06ca81 - Show all commits

View file

@ -3,6 +3,7 @@ package router
import ( import (
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware" "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/app"
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/controllers/taskcontroller" "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 := reposervice.New(r.app)
repoService.ForceUpdate() repoService.ForceUpdate()
s, _ := gocron.NewScheduler()
defer func() { _ = s.Shutdown() }()
_, _ = s.NewJob(
gocron.CronJob(
"0 4 * * *",
false,
),
gocron.NewTask(
func() {
repoService.ForceUpdate()
},
),
)
taskController := taskcontroller.New( taskController := taskcontroller.New(
r.app, r.app,
taskService, taskService,