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/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.

Index state changes for the activity feed

4d938fe894d56ff29b87fa0f2ebec50a744f2993 · Keenan Nemetz · 10d ago · parent e2a58f3a

Index state changes for the activity feed

The activity feed found closed, reopened and merged events by reading the
last 200 metadata commit subjects on every render: one git process per
repository, so the instance home with N repositories ran N of them. It was
the last derived read still going to git.

- A `state_changes` table is fed by the same refresh: a delta reads the
  commits in its range, a rebuild reads the whole metadata branch. Rows are
  keyed by the commit, so a retried or overlapping refresh cannot duplicate
  an event, and an ordinal keeps two changes in one second in branch order
  (commit times are seconds; a close and a reopen often share one).
- `Store.StateChanges` returns the events newest first; the feed reads it
  and keeps the metadata log as the fallback for a server without an index
  or a failed read.
- `git.Repo.Log` and `CommitsBetween` treat a limit of zero as no limit,
  which the rebuild needs, and `metadata.ParseStateSubject` is exported so
  the index derives the events without a second copy of the format.

The activity page now starts no metadata log; the instance home and the
instance activity page lose one process per visible repository. On the
load harness with three repositories: activity 496 req/s (p50 7 ms),
instance activity 230 req/s (p50 17 ms), home 202 req/s (p50 20 ms).

Schema version 7 rebuilds each repository on its first read after upgrade.

core/git/git.go +6−2

@@ -886,8 +886,12 @@ func scrubbedEnv() []string {
886 886
887 887 // Log returns up to n commits from rev.
888 888 func (r *Repo) Log(rev string, n int) ([]Commit, error) {
889 out, errs, err := r.run(nil, "log", "--format="+commitFormat,
890 "-n", strconv.Itoa(n), rev, "--")
889 args := []string{"log", "--format=" + commitFormat}
890 if n > 0 {
891 args = append(args, "-n", strconv.Itoa(n))
892 }
893 args = append(args, rev, "--")
894 out, errs, err := r.run(nil, args...)
891 895 if err != nil {
892 896 return nil, fmt.Errorf("log %q: %w: %s", rev, err, errs)
893 897 }