Files
davidandClaude Opus 5.5 c6c4c40600 Phase 9, part 6: background work shared safely between copies of the app
internal/jobs keeps named locks as leases in the database (schema 31:
locks, instances), taken with one conditional UPDATE on SQLite or Postgres,
renewed while the work runs and lapsing if its copy stops. Each background
loop's turn, sending an email, audits, discovery runs and imports run
under a lock; OAuth sign-ins under way are kept in the database. Copies
check in, and work marked running is recovered at start only when no
other copy is alive. Settings -> About lists the copies and work under
way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 07:56:47 -07:00

33 lines
1.7 KiB
HTML

{{define "content"}}{{template "settings-start" .}}{{with .Data}}
<h2>About</h2>
<p class="lede">This Supermarket: its edition, its version, and where it keeps things.</p>
<section class="card">
<h2>{{.Edition.Name}} edition</h2>
<dl class="facts">
<dt>Version</dt><dd>{{.Version}} <span class="muted">· database schema {{.Schema}}</span></dd>
{{range .Items}}<dt>{{.Name}}</dt><dd>{{.Value}}{{if .Help}} <span class="help">{{.Help}}</span>{{end}}</dd>
{{end}}
</dl>
{{if eq (print .Edition) "local"}}
<p class="help">Supermarket also comes as a <strong>server</strong> edition, for a team signing in on a server, and a <strong>multi-tenant</strong> one, for many teams at one address. The edition is chosen with <code>SUPERMARKET_MODE</code> when it starts; <code>supermarket config</code> checks the settings.</p>
{{end}}
</section>
<section class="card">
<h2>Running</h2>
<p class="help">Copies of Supermarket using this database, and the work each has under way. Only one copy does a background job at a time; if one stops, another takes its work over within two minutes.</p>
<table class="list">
<thead><tr><th>Copy</th><th>Host</th><th>Version</th><th>Started</th><th>Last seen</th></tr></thead>
<tbody>
{{range .Copies}}<tr><td><code>{{.ID}}</code>{{if .This}} <span class="muted">(this one)</span>{{end}}</td><td>{{.Host}}</td><td>{{.Version}}</td><td>{{ago .Started}}</td><td>{{ago .Seen}}</td></tr>
{{end}}
</tbody>
</table>
{{if .Locks}}
<h3>Under way</h3>
<ul>{{range .Locks}}<li><code>{{.Name}}</code> on <code>{{.Instance}}</code>, since {{ago .Since}}</li>{{end}}</ul>
{{else}}<p class="muted">No background work under way just now.</p>{{end}}
</section>
{{end}}{{template "settings-end"}}{{end}}