Follow-up from T236880: Document when to use different ILoadBalancer::get*Connection* methods.
These two methods take the same arguments, and return the same logical object, and of the exact same type (DBConnRef).
The only difference:
- getConnectionRef will pre-connect to the underlying database, thus the DBConnRef is only providing automatic re-use once out of scope.
- getLazyConnectionRef lets DBConnRef auto-connect upon first relevant method call, and also provides the same automatic re-use once out of scope.
From what I can tell, deferring the connect call is not expensive, and the __call() overhead for auto-connecting is present in both cases as well.
Would it make sense to change getConnectionRef to also be lazy, and then phase out getLazyConnectionRef?
Is there a use case from a feature/product perspective of where code wants to preconnect to get a desirable change in behaviour or some other benefit?