A pattern emerged in the new term storage related db classes that maintains DB connections as class properties.
This goes against current patterns, and means that a reference to the db connection may hang around for longer than expected and this may not be desirable.
The pattern that should be used is:
- Inject a loadbalancer
- Get a connection from the load balancer when needed (repeated calls will end up getting the same connection)
- Let the connection naturally fall out of scope at the end of your method
A very crude code search for this pattern in wikibase is: https://codesearch.wmflabs.org/extensions/?q=%5C%24this-%3E.*%20%3D%20.*-%3EgetConnection&i=nope&files=&repos=Extension:Wikibase