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/request_view.go +3−3

@@ -450,7 +450,7 @@ func (w *Web) SearchRequestIssues(rw http.ResponseWriter, r *http.Request) {
450 450 if !ok {
451 451 return
452 452 }
453 req, err := metadata.GetRequest(m.Git(), r.PathValue("id"))
453 req, err := w.requestAt(memoOf(r), m, r.PathValue("id"))
454 454 if err != nil {
455 455 w.notFound(rw, r)
456 456 return
@@ -583,7 +583,7 @@ func (w *Web) RequestLive(rw http.ResponseWriter, r *http.Request) {
583 583 if !ok {
584 584 return
585 585 }
586 req, err := metadata.GetRequest(m.Git(), r.PathValue("id"))
586 req, err := w.requestAt(memoOf(r), m, r.PathValue("id"))
587 587 if err != nil {
588 588 w.notFound(rw, r)
589 589 return
@@ -634,7 +634,7 @@ func (w *Web) renderRequestPage(rw http.ResponseWriter, r *http.Request, errMsg
634 634 if !ok {
635 635 return
636 636 }
637 req, err := metadata.GetRequest(m.Git(), r.PathValue("id"))
637 req, err := w.requestAt(memoOf(r), m, r.PathValue("id"))
638 638 if err != nil {
639 639 w.notFound(rw, r)
640 640 return