For #1188 we eliminated direct instantiation of the stfc datasource classes to ensure we only used the one instance created by tsyringe. This was to ensure efficient use of the caches for slow external user data within those data sources, as having multiple instances of those caches mean we have to populate them with slow external service calls for each instance.
To ensure we don't re-introduce the problem, we should see if there's any way to annotate the classes or their constructors so that creating a new instance directly causes a linting error, or something similar.
What is the problem and why is it a problem
For #1188 we eliminated direct instantiation of the stfc datasource classes to ensure we only used the one instance created by tsyringe. This was to ensure efficient use of the caches for slow external user data within those data sources, as having multiple instances of those caches mean we have to populate them with slow external service calls for each instance.
To ensure we don't re-introduce the problem, we should see if there's any way to annotate the classes or their constructors so that creating a new instance directly causes a linting error, or something similar.
Steps to reproduce (if it's a bug).