func Home(ctx *middleware.Context) { pv := models.RefreshPageView("/") repos, err := models.GetAllRepos(50, 0) if err != nil { log.Errorf("get repos from db error: %v", err) } ctx.Data["Title"] = "home" ctx.Data["Repos"] = repos ctx.Data["PV"] = pv ctx.HTML(200, "home") }
// keep task status always avaliable func drainTask() { for { log.Infof("drain task start after 25min") time.Sleep(25 * time.Minute) if repos, err := models.GetAllRepos(1000, 0); err == nil { for _, r := range repos { routers.TriggerBuildRepositoryById(r.Id) } } } }
func Search(ctx *middleware.Context) { log.Info(ctx.Request.RequestURI) pv := models.RefreshPageView(ctx.Request.RequestURI) repos, err := models.GetAllRepos(50, 0) if err != nil { log.Errorf("get repos from db error: %v", err) } ctx.Data["Title"] = "home" ctx.Data["Repos"] = repos ctx.Data["PV"] = pv ctx.HTML(200, "search") }