commanded / eventstore

Event store using PostgreSQL for persistence
MIT License
1.06k stars 146 forks source link

Terminate a monitored process only if there are no other processes registered to use it #272

Closed slashdotdash closed 1 year ago

slashdotdash commented 1 year ago

When using a shared database connection pool amongst event stores the Postgrex database connection should only be stopped when all event stores using the connection have been stopped.

Previously the event store which started the Postgrex connection was responsible for terminating it. This was problematic if using dynamic event stores which may be started and stopped in any order. If the event store which started first and which started the shared connection pool was later stopped then any other event stores using the same connection pool could encounter an issue until the connection was restarted by one of them.