update repository list on timer instead of generating per request
1 file changed, 4 insertions(+), 2 deletions(-)
changed files
M routes/routes.go → routes/routes.go
@@ -10,6 +10,7 @@ "strconv" "strings" "alin.ovh/elgit/config" + "alin.ovh/elgit/data" "alin.ovh/elgit/git" "alin.ovh/elgit/templates" "github.com/microcosm-cc/bluemonday"@@ -21,10 +22,11 @@ type deps struct { c *config.Config projects []string + repos *data.Entries } func (d *deps) Index(rc *atreugo.RequestCtx) error { - repos := d.getAllRepos() + pageData := templates.PageData{ Meta: d.c.Meta,@@ -32,7 +34,7 @@ } rc.SetContentType("text/html; charset=utf-8") - return templates.IndexPage(pageData, repos).Render(rc) + return templates.IndexPage(pageData, d.repos).Render(rc) } func (d *deps) RepoIndex(rc *atreugo.RequestCtx) error {