all repos — elgit @ 8f562b78446b9fb5bfc73a6f41788647a3779189

fork of legit: web frontend for git, written in go

update repository list on timer instead of generating per request

Alan Pearce
commit

8f562b78446b9fb5bfc73a6f41788647a3779189

parent

975625f9d4d26eb56f4428f2921b9e1090a49621

1 file changed, 11 insertions(+), 2 deletions(-)

changed files
M routes/handler.goroutes/handler.go
@@ -13,6 +13,7 @@ "github.com/fsnotify/fsnotify"
"github.com/savsgio/atreugo/v11" "alin.ovh/elgit/config" + "alin.ovh/elgit/data" ) var ErrMethodNotAllowed = fmt.Errorf("that's not possible")
@@ -26,8 +27,9 @@ log.Fatal(err)
} d := deps{ - c, - projects, + c: c, + projects: projects, + repos: &data.Entries{}, } addr := net.JoinHostPort(c.Server.Host, strconv.FormatInt(c.Server.Port, 10))
@@ -60,6 +62,13 @@ err = watcher.Add(plist)
if err != nil { log.Fatal(err) } + + go func() { + d.UpdateRepos() + for range time.Tick(time.Minute) { + d.UpdateRepos() + } + }() go func() { for {