UserOfficeProject / issue-tracker

Shared place for features and bugs from all collaborators.
0 stars 0 forks source link

Investigate if we can use annotations to fail lint checks if we directly instantiate STFC data source classes #1201

Open ACLay opened 3 weeks ago

ACLay commented 3 weeks ago

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).