NCEAS / metadig-engine

MetaDig Engine: multi-dialect metadata assessment engine
7 stars 5 forks source link

ensure postgres connections aren't dropped #420

Closed jeanetteclark closed 2 months ago

jeanetteclark commented 3 months ago

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

jeanetteclark commented 3 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

jeanetteclark commented 2 months ago

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