mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-11-12 03:36:10 -06:00
db.NewSession begins a transaction, so every request holds one pooled connection for its whole life: across the API's own work and every round trip in between. At 20,000 simulated users that filled a 192-connection pool with 170 backends idle in transaction while 13 were active, and the database sat at 40 % CPU with p99 at 94 ms. NewReadSession attaches the session memo but does not Begin; each statement borrows a connection only for itself. Commit and Rollback are no-ops on it, so DoReadOne, DoReadAll and ValidateAPITokenString keep their shape. A read path that writes (position healing) now commits per statement.