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.

Read what a page needs once per request

5d440e37f16d06790ce87e2f8b7dcc7d9bf0532c · Keenan Nemetz · 10d ago · parent 34cbc99f

Read what a page needs once per request

A page and its header are built from the same facts, and each of them was
read separately: the repository (twice, each resolving HEAD's branch with
a git call), the open change requests (once for the header's count, once
for the page), and a change request looked up by reading every request.
On a repository with 30 change requests the overview paid 21 git
invocations after the metadata batching, and the requests list still paid
8.

Give each read request one memo, installed by the middleware, and have the
handlers and the header read through it. It lasts one request and covers
reads only: a request that writes metadata gets no memo, so there is no
TTL, no cross-request cache, and no invalidation protocol, and a push is
still visible on the next page load.

The header now takes the page it is rendering (`nav .Page "issues"`)
instead of six fields the view already carries, which is also why the memo
can reach it at all. Templates are unchanged in what they output.

server/web/activity.go +3−3

@@ -78,7 +78,7 @@ func normalizeActivityKind(kind string) string {
78 78 return ""
79 79 }
80 80
81 func (w *Web) repoActivity(m *repo.Meta, kind, actor, assignee string) activityFeed {
81 func (w *Web) repoActivity(memo *requestMemo, m *repo.Meta, kind, actor, assignee string) activityFeed {
82 82 g := m.Git()
83 83 var events []activityEvent
84 84 var lastCommit *git.Commit
@@ -130,7 +130,7 @@ func (w *Web) repoActivity(m *repo.Meta, kind, actor, assignee string) activityF
130 130 }
131 131
132 132 if kind == "" || kind == "change" {
133 if requests, err := metadata.LoadRequests(g, metadata.Ref); err == nil {
133 if requests, err := w.requestsAt(memo, m); err == nil {
134 134 for _, req := range requests {
135 135 if req.Open() {
136 136 openChanges++
@@ -294,7 +294,7 @@ func (w *Web) Activity(rw http.ResponseWriter, r *http.Request) {
294 294 kind := normalizeActivityKind(r.URL.Query().Get("kind"))
295 295 actor := strings.TrimSpace(r.URL.Query().Get("actor"))
296 296 assignee := strings.TrimSpace(r.URL.Query().Get("assignee"))
297 feed := w.repoActivity(m, kind, actor, assignee)
297 feed := w.repoActivity(memoOf(r), m, kind, actor, assignee)
298 298 view := activityView{
299 299 Page: w.page(r, m.Name+" · activity"), Name: m.Name, Kind: kind,
300 300 Actor: actor, Assignee: assignee,