tcoopman
Ecto_sqlite different read and write pools
Context: I want to apply some of the recommendations specified in this article https://kerkour.com/sqlite-for-servers
Specifically: 1 Write connection, multiple Read connections
My thought on how to solve this was to use 2 different ecto repos, one for writes, one for reads and give the read repo a pool_size of 1 and the read a different, bigger pool_size.
That seems to work ok, but I run into a problem with testing and the ecto sandbox.
Because ofcourse there are now 2 sandboxes and the read repo can’t read what the write repo wrote.
Here are my thoughts on how to solve this:
- don’t use 2 different repo’s and accept that I can’t do what the article suggests
- maybe there is an other way with 1 repo that allows me to set different read and write pools
- fix the tests by removing the sandbox and cleaning up the db manually after each test - ecto_sqlite3 doesn’t allow async tests anyway, so this would not be to much of an issue
- …?
Does anyone have any suggestion?
Most Liked
LostKobrakai
D4no0
No issues besides the potential error prone behavior of doing this manually, well at least as long as you don’t try to write from both repos.







