4cat
4cat copied to clipboard
module_loader loads "disabled" datasources
Or at least I think that is what is happening. After merging the TCAT datasources, I noticed that their get_options is being called even though they are disabled/inactive/not listed in the data source configuration in 4CAT settings (left over debugging log). It looks like get_options is being called twice. My guess is the module_loader when it calls expand_datasources, but I cannot find a second instance where it ought to be called. I need to better debug it figure out what actually is calling it.
Unsure if we need to fix that, but it seems odd that we're loading datasources that are not enabled. I don't think it is an issue, just unnecessary overhead.
Yes, this is as intended, because that way datasources can be disabled/enabled on the fly without having to restart 4CAT. Alternatively we might allow loading/unloading datasources on the fly as the DATASOURCES setting is changed.
https://github.com/digitalmethodsinitiative/4cat/commit/c06652279d408018623ba8d5e183a63eb987ea8c
That makes sense. Here I was thinking I should look over TCAT's get_options since it calls a database for information (it seems fine, but perhaps could just return immediately if not enabled). I'm also curious if there could be any unnecessary overhead as we add new datasources. Thinking particularly of the Selenium based ones. Likely it would just be importing unnecessary libraries (which we may want to check anyway to see if the datasources can be enabled).
After working on the related code a bit (for #310) I think for now we want to keep this as-is, until it comes a resources issue (if that happens).