4cat icon indicating copy to clipboard operation
4cat copied to clipboard

module_loader loads "disabled" datasources

Open dale-wahl opened this issue 3 years ago • 3 comments

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.

dale-wahl avatar Oct 04 '22 11:10 dale-wahl

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.

stijn-uva avatar Oct 04 '22 11:10 stijn-uva

https://github.com/digitalmethodsinitiative/4cat/commit/c06652279d408018623ba8d5e183a63eb987ea8c

dale-wahl avatar Oct 04 '22 11:10 dale-wahl

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

dale-wahl avatar Oct 04 '22 11:10 dale-wahl

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

stijn-uva avatar Nov 18 '22 18:11 stijn-uva