Okay, it looks like the rate limiting is checked first, here:

And the check whether the translated text has already been saved to the database is done after that, here:

I guess a good solution would be to move the “checking whether something is in cache” logic out of the DiscourseTranslator::Base.from_custom_fields method and into DiscourseTranslator::TranslatorController.translate so the order of rate-limiting and cache-checking can be switched.

However, I won’t create a PR because I don’t know Ruby at all. Maybe someone with at least some basic knowledge in Ruby could get this done.

3 Likes