Phase 13, part 5: each team's jobs, locks, files and sign-ins

Background jobs run for each active team on its own Server and under its
own locks, a few teams at a time and from a different team each round, so
the work is shared between copies of the app and no team holds up another.
Each team's files are under its own prefix, and an OAuth sign-in comes
back only to the team that started it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:26:33 -07:00
co-authored by Claude Opus 5.5
parent 47cc8b2b10
commit af6598271c
16 changed files with 275 additions and 40 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ func (s *Server) RunMetrics(ctx context.Context) {
tick := time.NewTicker(10 * time.Minute)
defer tick.Stop()
for {
s.jobDo(ctx, "metrics", func(ctx context.Context) {
s.jobDo(ctx, "metrics", func(ctx context.Context, s *Server) {
if c := s.stripe(); c != nil {
if _, err := metrics.SyncOutsideSpend(s.DB, time.Now()); err != nil {
s.Log.Warn("metrics: outside spend", "err", err)