vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Remove page-view tracking
0a12642f6c01236d1fbd4ee06aaa2bd2283c6bf0 · Keenan Nemetz · 3d ago · parent 8f6548a6
Remove page-view tracking Counting a page wrote a row to instance.db on every successful HTML GET, so reading the instance contended with CI and the merge worker for the one write lock. The counters answered one status page and were not part of what a restore has to keep, so the feature is gone rather than moved. The status overview loses its page-view card and table; the rest of the Admin page is unchanged. An instance that recorded views keeps the old page_views table in instance.db, which nothing reads. Refs #398
forge/instance.go +10−26
| @@ -24,7 +24,6 @@ import ( | |||
| 24 | 24 | "rodent.software/vole/forge/identity" | |
| 25 | 25 | "rodent.software/vole/forge/index" | |
| 26 | 26 | "rodent.software/vole/forge/instancerepo" | |
| 27 | "rodent.software/vole/forge/pageview" | ||
| 28 | 27 | "rodent.software/vole/forge/repo" | |
| 29 | 28 | "rodent.software/vole/forge/secret" | |
| 30 | 29 | "rodent.software/vole/forge/session" | |
| @@ -34,17 +33,16 @@ import ( | |||
| 34 | 33 | ||
| 35 | 34 | // Instance is the state a running or administered Vole instance owns. | |
| 36 | 35 | type Instance struct { | |
| 37 | Cfg *config.Config | ||
| 38 | Repos *repo.Store | ||
| 39 | Identity *identity.Store | ||
| 40 | Sessions *session.Store | ||
| 41 | Index *index.Store | ||
| 42 | Runs *runs.Store | ||
| 43 | ACLs *access.Store | ||
| 44 | Locks *lfs.LockStore | ||
| 45 | LFS *lfs.Store | ||
| 46 | Logs *logs.Store | ||
| 47 | PageViews *pageview.Store | ||
| 36 | Cfg *config.Config | ||
| 37 | Repos *repo.Store | ||
| 38 | Identity *identity.Store | ||
| 39 | Sessions *session.Store | ||
| 40 | Index *index.Store | ||
| 41 | Runs *runs.Store | ||
| 42 | ACLs *access.Store | ||
| 43 | Locks *lfs.LockStore | ||
| 44 | LFS *lfs.Store | ||
| 45 | Logs *logs.Store | ||
| 48 | 46 | // InstanceRepo is the repository whose tree customizes the instance: the | |
| 49 | 47 | // profile README, custom CSS, favicon, and assets. Nil or disabled means the | |
| 50 | 48 | // instance keeps its built-in presentation. | |
| @@ -154,23 +152,12 @@ func Open(cfg *config.Config, binPath string) (*Instance, error) { | |||
| 154 | 152 | ident.Close() | |
| 155 | 153 | return nil, err | |
| 156 | 154 | } | |
| 157 | views, err := pageview.Open(cfg.InstanceDB()) | ||
| 158 | if err != nil { | ||
| 159 | lk.Close() | ||
| 160 | acls.Close() | ||
| 161 | rn.Close() | ||
| 162 | ix.Close() | ||
| 163 | sessions.Close() | ||
| 164 | ident.Close() | ||
| 165 | return nil, fmt.Errorf("open page views: %w", err) | ||
| 166 | } | ||
| 167 | 155 | ||
| 168 | 156 | // Secrets are opened last because nothing else depends on them, and they are | |
| 169 | 157 | // the one store whose failure an operator can act on: a key file that does not | |
| 170 | 158 | // match the database is a restore that cannot read what it restored. | |
| 171 | 159 | secrets, err := secret.Open(cfg.InstanceDB(), cfg.SecretsKeyPath()) | |
| 172 | 160 | if err != nil { | |
| 173 | views.Close() | ||
| 174 | 161 | lk.Close() | |
| 175 | 162 | acls.Close() | |
| 176 | 163 | rn.Close() | |
| @@ -188,7 +175,6 @@ func Open(cfg *config.Config, binPath string) (*Instance, error) { | |||
| 188 | 175 | channels, err := channel.Open(cfg.InstanceDB()) | |
| 189 | 176 | if err != nil { | |
| 190 | 177 | secrets.Close() | |
| 191 | views.Close() | ||
| 192 | 178 | lk.Close() | |
| 193 | 179 | acls.Close() | |
| 194 | 180 | rn.Close() | |
| @@ -209,7 +195,6 @@ func Open(cfg *config.Config, binPath string) (*Instance, error) { | |||
| 209 | 195 | Locks: lk, | |
| 210 | 196 | LFS: lfs.New(cfg.LFSDir(), cfg.LFSObjectMaxBytes), | |
| 211 | 197 | Logs: logs.New(cfg.LogsDir()), | |
| 212 | PageViews: views, | ||
| 213 | 198 | InstanceRepo: instancerepo.New(rs, cfg.InstanceRepo), | |
| 214 | 199 | Secrets: secrets, | |
| 215 | 200 | Channels: channels, | |
| @@ -314,7 +299,6 @@ func (i *Instance) Close() error { | |||
| 314 | 299 | for _, closeFn := range []func() error{ | |
| 315 | 300 | i.Channels.Close, | |
| 316 | 301 | i.Secrets.Close, | |
| 317 | i.PageViews.Close, | ||
| 318 | 302 | i.Locks.Close, | |
| 319 | 303 | i.ACLs.Close, | |
| 320 | 304 | i.Runs.Close, | |