Thanks for the txdb package, it’s a nice optimization when running many database tests :)
I noticed one issue, though, and wanted to ask if the issue is known or to be expected.
I’m working on a server which maintains multiple caches in the background (i.e. separate goroutines query the database and store the result in memory). My test code starts up a server and makes some database updates/queries itself.
Sometimes, the background goroutine which queries the database reports an error like update: pq: unexpected DataRow in simple query execution and the test itself errors out with pg.Close(): driver: bad connection.
These issues disappear once I add a pg.SetMaxOpenConns(1) call in my test setup.
So I was wondering: Are concurrent database connections supposed to work with txdb?
Thanks for the txdb package, it’s a nice optimization when running many database tests :)
I noticed one issue, though, and wanted to ask if the issue is known or to be expected.
I’m working on a server which maintains multiple caches in the background (i.e. separate goroutines query the database and store the result in memory). My test code starts up a server and makes some database updates/queries itself.
Sometimes, the background goroutine which queries the database reports an error like
update: pq: unexpected DataRow in simple query executionand the test itself errors out withpg.Close(): driver: bad connection.These issues disappear once I add a
pg.SetMaxOpenConns(1)call in my test setup.So I was wondering: Are concurrent database connections supposed to work with txdb?