vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Store the overview's summaries when a push lands
2a8f7cef47240564179a45126863d1ccd8d9d362 · Keenan Nemetz · 10d ago · parent 8dc56e4e
Store the overview's summaries when a push lands The repository overview walked git on every read: `rev-parse` for the tip, `log` for the last five commits, `for-each-ref` for tags, `ls-tree` plus `shortlog` for languages and contributors, and a `cat-file` for the README. All of those describe a ref except the README, and a ref moves only when a push lands, so the push now records them. - Schema v10 adds `repo_languages`, `repo_commits`, `repo_contributors` and `repo_tags`. - `RefreshHead` stores the tip's newest commits and its language breakdown from one `ls-tree -r -l`, and returns whether the tip moved. - `RefreshContributors` stores the top authors; the hook calls it only when the tip changed, never on a metadata or tag push. - `RefreshTags` stores the tag rows beside the release events it already rewrote, and `IndexRepo` now refreshes tags and contributors too, so a rebuild restores everything a push would have written. - The overview reads those rows when the recorded head is the branch tip (`RefCommit` is a loose-ref file read) and falls back to git when it is not, so a missed hook shows the correct page rather than a stale one. If one stored section is empty on a repository with commits, that section alone is re-read from git. - The sidebar asks SQL for five open issues and changes instead of sorting the whole open queue in memory. - The rendered README is cached by repository, commit and ref under a byte budget, so the overview's last git spawn is gone after the first read of a commit. - The language fallback reads one `ls-tree -r -l` instead of `ls-tree` followed by a `cat-file --batch-check`. - `Remove` deletes every derived row for a repository, not only its row. Load harness at concurrency 4: overview goes from 473 to about 740 req/s, p50 from 8 ms to 5 ms, and the server runs no git child process for the warm requests.
forge/index/events.go +25
| @@ -258,12 +258,37 @@ func (s *Store) RefreshTags(m *repo.Meta) error { | |||
| 258 | 258 | if err != nil { | |
| 259 | 259 | return err | |
| 260 | 260 | } | |
| 261 | if err := replaceTagRows(tx, m.ID, tags); err != nil { | ||
| 262 | return err | ||
| 263 | } | ||
| 261 | 264 | if err := bumpEventCount(tx, m.ID, inserted-deleted); err != nil { | |
| 262 | 265 | return err | |
| 263 | 266 | } | |
| 264 | 267 | return tx.Commit() | |
| 265 | 268 | } | |
| 266 | 269 | ||
| 270 | // replaceTagRows stores the tag list the releases sections read. A tag is a ref, | ||
| 271 | // so this is not a metadata commit either: every push refreshes it alongside the | ||
| 272 | // release events, and a rebuild does the same. | ||
| 273 | func replaceTagRows(tx execer, repoID string, tags []git.Tag) error { | ||
| 274 | if _, err := tx.Exec(`DELETE FROM repo_tags WHERE repo_id=?`, repoID); err != nil { | ||
| 275 | return err | ||
| 276 | } | ||
| 277 | for _, t := range tags { | ||
| 278 | annotated := 0 | ||
| 279 | if t.Annotated { | ||
| 280 | annotated = 1 | ||
| 281 | } | ||
| 282 | if _, err := tx.Exec( | ||
| 283 | `INSERT INTO repo_tags(repo_id, name, oid, commit_sha, annotated, tagger, when_at, subject) | ||
| 284 | VALUES(?,?,?,?,?,?,?,?)`, | ||
| 285 | repoID, t.Name, t.OID, t.Commit, annotated, t.Tagger, t.When, t.Subject); err != nil { | ||
| 286 | return err | ||
| 287 | } | ||
| 288 | } | ||
| 289 | return nil | ||
| 290 | } | ||
| 291 | |||
| 267 | 292 | // eventFilter is the WHERE clause the count and the page share. Kind is the | |
| 268 | 293 | // event kind (issue, change, release); the empty kind is the whole feed. | |
| 269 | 294 | func eventFilter(repoIDs []string, kind, actor, assignee string) (string, []any) { | |