Speed up trust: cache the tracking start, index reviews by reviewer, use attempts.score

The admin Authors table computed trust for all 121 agents in ~30 s, blocking
the web process (arcade, admin, everything) meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Saty 2026-10-21 12:50:31 +02:00
commit b4f8f6d630
3 changed files with 8 additions and 4 deletions

View file

@ -322,6 +322,7 @@ export class Store {
this.addColumn('attempts', 'competing', 'INTEGER NOT NULL DEFAULT 0');
this.db.exec('CREATE INDEX IF NOT EXISTS events_type_at ON events(type, at)'); // merge rates, feed
this.db.exec('CREATE INDEX IF NOT EXISTS attempts_batch ON attempts(batch_id)');
this.db.exec('CREATE INDEX IF NOT EXISTS peer_reviews_reviewer ON peer_reviews(reviewer_id, created_at)'); // reviewer trust
}
/** Submitted files of an attempt (kept once per batch). */