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.
Stop repeating the index check and the history summaries
73ec800beafe53eea186fbc1cebec3306cc49da0 · Keenan Nemetz · 10d ago · parent 5d440e37
Stop repeating the index check and the history summaries The request memo covered the repository, the open counts and the change list, but two more reads were repeated: - The index refresh (issue rows, filters, `#42` numbers) ran on every surface that shows one, and each run started by resolving the metadata ref. A page calls it from the header, the number lookup and its own view, so it now happens once per request, and the resolved commit is shared with the change-request read instead of being resolved twice. - The overview walked the repository's whole history on every load: `shortlog` for contributors, `rev-list --count` for the code page's commit count, and the tree grouping for languages. Those are properties of a commit, and a commit id is content-addressed, so they cannot go stale: they are remembered by commit id in a bounded per-process cache that evicts oldest-first. On the fixture (30 change requests, 30 issues) the overview drops from 19 git calls to 9 on a repeated load, the code page from 12 to 11, and every page loses one `rev-parse` for the metadata ref.
server/web/overview.go +5−15
| @@ -69,9 +69,7 @@ func (w *Web) Overview(rw http.ResponseWriter, r *http.Request) { | |||
| 69 | 69 | var languages []languageShare | |
| 70 | 70 | if commit != "" { | |
| 71 | 71 | commits, _ = g.Log(commit, 5) | |
| 72 | if blobs, err := g.TreeBlobs(commit); err == nil { | ||
| 73 | languages = languageShares(blobs) | ||
| 74 | } | ||
| 72 | languages = w.languages(g, commit) | ||
| 75 | 73 | } | |
| 76 | 74 | ||
| 77 | 75 | var tags []git.Tag | |
| @@ -82,17 +80,9 @@ func (w *Web) Overview(rw http.ResponseWriter, r *http.Request) { | |||
| 82 | 80 | tags = list | |
| 83 | 81 | } | |
| 84 | 82 | ||
| 85 | var contributors []contributorView | ||
| 86 | if list, err := g.Contributors(commit); err == nil { | ||
| 87 | shown := list | ||
| 88 | if len(shown) > 8 { | ||
| 89 | shown = shown[:8] | ||
| 90 | } | ||
| 91 | for _, c := range shown { | ||
| 92 | contributors = append(contributors, contributorView{ | ||
| 93 | Name: c.Name, Commits: c.Commits, Initial: initial(c.Name), Tone: tone(c.Name), | ||
| 94 | }) | ||
| 95 | } | ||
| 83 | contributors := w.contributors(g, commit) | ||
| 84 | if len(contributors) > 8 { | ||
| 85 | contributors = contributors[:8] | ||
| 96 | 86 | } | |
| 97 | 87 | ||
| 98 | 88 | var recentRuns []*runs.Run | |
| @@ -142,7 +132,7 @@ func (w *Web) Overview(rw http.ResponseWriter, r *http.Request) { | |||
| 142 | 132 | func (w *Web) overviewRecent(memo *requestMemo, m *repo.Meta) (issues, requests []overviewEntity) { | |
| 143 | 133 | var numbers map[string]int | |
| 144 | 134 | if w.Index != nil { | |
| 145 | if err := w.Index.Ensure(m); err == nil { | ||
| 135 | if err := w.ensureIndex(memo, m); err == nil { | ||
| 146 | 136 | if nums, err := w.Index.Numbers(m.ID); err == nil { | |
| 147 | 137 | numbers = nums | |
| 148 | 138 | } | |