Closed jeanetteclark closed 7 months ago
Matthew gave me a great idea to use try with resources blocks instead of try/catch/finally. I pushed these changes to bugfix-postgres-connections. There is possibly still more room for improvement - especially in making sure connections don't stay open longer than they need to.
Tests are passing on that branch right now, but test coverage isn't great so more local testing + testing on the dev cluster is needed
Testing on the dev cluster went well. I also tweaked the pgbouncer configuration to allow for more clients. I also changed the default pool size to match the number of max connections
here's a place where we might fail to close a connection:
https://github.com/NCEAS/metadig-engine/blob/main/src/main/java/edu/ucsb/nceas/mdqengine/model/Run.java#L284
need to look for instances where a database store is instantiated and ensure that it is shut down in a
finally
block instead of in a try block along with some other stuff