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.

Drive the home rail from the events table

20442b5948ea72c5e84b6cf2ff922f3cc987ac13 · Keenan Nemetz · 9d ago · parent bca9ec24

Drive the home rail from the events table

The landing page still built every visible repository's whole feed in
memory to show the newest ten events across the instance. It now asks the
events table for one bounded page, with the repository names attached, so
the rail costs a page instead of the history.

The cards are separated from the feed:

- counts come from the index (issue and change totals);
- the newest event time per card is one grouped query (`LastEventTimes`)
  instead of deriving it from the feed that was built anyway;
- the release chip comes from the newest release event (`LastReleases`)
  instead of listing tags from git per card;
- the head commit and language still come from git, which is the
  remaining per-repository work on the page.

`visibleRepos` now builds handles with `Meta` rather than `Open`, which
removes a `symbolic-ref` per repository from the landing page and the
instance activity page. The all-git card builder stays as the fallback
for a Web without an index.

Load harness at concurrency 4 with three repositories: home goes from 178
to 243 req/s, p50 from 21 ms to 16 ms.

server/home_test.go +30

@@ -5,11 +5,14 @@ package server_test
5 5 // about the work rather than the log.
6 6
7 7 import (
8 "fmt"
8 9 "path/filepath"
9 10 "strings"
10 11 "testing"
12 "time"
11 13
12 14 "github.com/rodent-software/vole/forge/config"
15 "github.com/rodent-software/vole/metadata"
13 16 )
14 17
15 18 func TestHomeIsALandingPage(t *testing.T) {
@@ -219,3 +222,30 @@ func TestHomeCardShowsTopLanguage(t *testing.T) {
219 222 t.Fatalf("home card has no top-language marker:\n%s", body)
220 223 }
221 224 }
225
226 // TestHomeRailShowsTheNewestEventsAcrossRepositories pins the rail to the events
227 // table: the newest events, bounded to what fits, with no per-repository walk of
228 // the whole feed.
229 func TestHomeRailShowsTheNewestEventsAcrossRepositories(t *testing.T) {
230 t.Parallel()
231 f := newFixture(t)
232 f.publish(f.repo)
233 m := mustRepo(t, f)
234 base := time.Date(2026, 10, 30, 12, 0, 0, 0, time.UTC)
235 for i := 0; i < 12; i++ {
236 iss, err := metadata.NewIssue(fmt.Sprintf("rail %02d", i), "body\n", "keenan", nil, nil, base.Add(time.Duration(i)*time.Minute))
237 if err != nil {
238 t.Fatal(err)
239 }
240 if err := metadata.CreateIssue(m.Git(), iss, "keenan"); err != nil {
241 t.Fatal(err)
242 }
243 }
244 _, body := f.get("/")
245 if n := strings.Count(body, `class="activity-event"`); n != 10 {
246 t.Fatalf("the rail shows %d events, want %d", n, 10)
247 }
248 if !strings.Contains(body, "rail 11") || strings.Contains(body, "rail 00") {
249 t.Fatalf("the rail is not the newest events:\n%s", body)
250 }
251 }