fix UI 503s under checkpoint load

- Store: skip identical CT checkpoint writes (CertSpotter calls StoreLogState
  per batch across 64 logs; hashing the state avoids redundant writes).
- webui: cache /api/stats for 10s and raise API query timeouts; UI polls, so
  repeated aggregate queries no longer queue behind checkpoint bursts.
- reword discovery detail (no 'name enumeration' for S3/GCS; only Azure uses a
  container list).
This commit is contained in:
StasonJatham committed 2026-09-22 17:45:18 +02:00
1 parent 32035d0b9d
commit 1ce5700cec
6 files changed
+50 -14

No files matched your search

+12 -1
View File
@@ -2,6 +2,7 @@ package store
import (
"context"
"crypto/sha256"
"encoding/json"
"fmt"
"log"
@@ -35,11 +36,21 @@ func (s *Store) StoreLogState(ctx context.Context, logID monitor.LogID, state *m
if err != nil {
return err
}
key := logID.Base64URLString()
hash := sha256.Sum256(data)
s.stateMu.Lock()
if prev, ok := s.lastState[key]; ok && prev == hash {
s.stateMu.Unlock()
return nil // unchanged; CertSpotter calls this per batch
}
s.lastState[key] = hash
s.stateMu.Unlock()
_, err = s.pool.Exec(ctx, `
INSERT INTO ct_checkpoints (log_id, state, updated_at)
VALUES ($1, $2, now())
ON CONFLICT (log_id) DO UPDATE SET state = EXCLUDED.state, updated_at = now()`,
logID.Base64URLString(), data)
key, data)
return err
}