simjanos-dev / LinguaCafe

LinguaCafe is a self-hosted software that helps language learners read foreign languages.
https://simjanos-dev.github.io/LinguaCafeHome/
GNU General Public License v3.0
762 stars 24 forks source link

Cache installed languages. #297

Open simjanos-dev opened 2 weeks ago

simjanos-dev commented 2 weeks ago

It is really slow when a user wants to select a different language. Installed languages could be cached on startup, and be updated when installed languages are changed on the admin page. The admin pages would still use the non-cached results, which are slower but 100% accurate.

@sergiolaverde0 Do you think this could cause any issues? The only problem I see is that if the model folder would be deleted while the server is running, the cache would not be updated, and users could select not installed languages, and if they try to import something, they get an error message.

sergiolaverde0 commented 2 weeks ago

Yes, that sounds right to me, at the beginning I proposed something similar and I still believe people deleting their files at runtime won't be a common occurrence, plus we have the fallback to the already existing system.

If this ever becomes an issue it is also possible that upon failed import we trigger a check for the installed languages, but I think it might be overkill.