Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Blame · server/instance_repo.go

Line attribution on main · 35 line(s)

6ce635a8
Keenan Nemetz
1d ago
1 package server
2
3 // The instance repository is reloaded on a short timer, the same trade the pages
4 // server makes for a site tip: a push is live within a couple of seconds, and a
5 // request never runs git. A load error keeps the previous snapshot; the warning
6 // is repeated only when the error changes, so a missing repository does not fill
7 // the log.
8
9 import (
10 "context"
11 "time"
12 )
13
14 const instanceRepoReload = 2 * time.Second
15
16 func (s *Server) watchInstanceRepo(ctx context.Context) {
17 t := time.NewTicker(instanceRepoReload)
18 defer t.Stop()
19 last := ""
20 for {
21 select {
22 case <-ctx.Done():
23 return
24 case <-t.C:
25 err := s.InstanceRepo.Reload()
26 switch {
27 case err == nil:
28 last = ""
29 case err.Error() != last:
30 s.Log.Warn("instance repository: cannot load", "repo", s.Cfg.InstanceRepo, "err", err)
31 last = err.Error()
32 }
33 }
34 }
35 }