-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent database access in cache:warmup #25
Comments
Check https://github.com/lexik/LexikTranslationBundle, there is a Command that does this, this bundle seems not to be integrated with a cache-warmup. edit: https://github.com/lexik/LexikTranslationBundle/blob/master/Translation/Loader/DatabaseLoader.php through this loader they run almost the same code as we do in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the
Zicht\Bundle\MessagesBundle\Translation\Loader
needs database access in thecache:clear
process to examine which translations are available to add to the overall catalogue for each locale. They will be merged with existing translations and somewhere later dumped to the cache-directory.This is bad practice, as it makes the applications stateful in a process that should be stateless. A cache-clear should be performed regardless of implementation details such as the database. If the filesystem it will be deployed on supports write-actions, this might be performed at a later stage.
Adding translations in cache-warmup is a sophisticated process traced back to several private methods in
Symfony\Bundle\FrameworkBundle\Translation\Translator
.Possible is a workaround such as:
catalogue.<locale>.*
from /var/cache/translationsOnly problem is a race-condition between normal requests filling the cache again and the execution of this new command.
Other solutions:
The text was updated successfully, but these errors were encountered: