mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00

This is designed to catch a class of SQL transaction bugs where we BEGIN a transaction and then forget to use that `txn` var, and do other things on `sql.DB` which will use a different connection. By testing with max conns = 1 this will deadlock. We also test with max conns = 2 to try to catch more pernicious failure modes. Using max conns = 1 effectively serialises access to the database, but some bugs may only be apparent when there is some limited amount of concurrency available e.g mid-processing this event, do X. With max conns = 1 we cannot test this, which is why we also test with max conns = 2.