You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you call databaseConfig.db, you are expected to close that db instance.
pekko-projection-slick has never bothered to do this.
It appears that pekko-projection-slick users create their own databaseConfig and it is left to them (at the moment) to know about and implement the databaseConfig.db.close() call. Have a look at SlickProjectionSpec to see how this test spec creates a databaseConfig and then in afterAll it calls databaseConfig.db.close()
If we were to take responsibility for closing the databaseConfig.db instances, there are some problems:
there is no lifecycle that we can rely on, we are probably left with adding a shutdown hook or something like that
There are a lot of functions in SlickProjection that call createOffsetStore and this createOffsetStore calls databaseConfig.db - potentially create a new db instance that needs managing. If you call databaseConfig.db more than once on the same databaseConfig instance, you should get the same db instance (they are lazily created and reused).
This is my opinion - I think we should not change anything and just document that users need to look after their own databaseConfig lifecycle.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When you call databaseConfig.db, you are expected to close that db instance.
pekko-projection-slick has never bothered to do this.
It appears that pekko-projection-slick users create their own databaseConfig and it is left to them (at the moment) to know about and implement the
databaseConfig.db.close()
call. Have a look at SlickProjectionSpec to see how this test spec creates a databaseConfig and then inafterAll
it callsdatabaseConfig.db.close()
If we were to take responsibility for closing the databaseConfig.db instances, there are some problems:
createOffsetStore
and thiscreateOffsetStore
callsdatabaseConfig.db
- potentially create a new db instance that needs managing. If you calldatabaseConfig.db
more than once on the same databaseConfig instance, you should get the same db instance (they are lazily created and reused).This is my opinion - I think we should not change anything and just document that users need to look after their own databaseConfig lifecycle.
Beta Was this translation helpful? Give feedback.
All reactions