Project

General

Profile

« Previous | Next » 

Revision b6b6ffc0

Added by Lukáš Zapletal about 3 years ago

Fixes #31717 - lazy-load fast_gettext for faster boot (#8275)

It's because we switch over all 20 languages to actually pull language name in the native language into a list of available languages. We use that in three places: settings page, user page and GraphQL.

This can be easily be lazy-loaded, so those 2 seconds are not wasted during startup. Only few languages are usually used, definitely not all of them.

Ewoud had a good point that this would prevent from sharing the translation cache (about 20MB) so we actually preload translations, but only in production. This way we can enjoy startups of Foreman in a dev environment by 2 seconds (which is actually 17% by local testing) while preloading everything in production (where the operation is a bit faster and reboot time not so painful).

View differences:

extras/dynflow-sidekiq.rb
world.before_termination do
SdNotify.stopping
end
# Loading and initializing of all gettext languages takes about 100ms per language
# in development environment and little less on production. Let's eager load languages
# but only for production.
FastGettext.human_available_locales
end
rails_env_file = File.expand_path('./config/environment.rb', rails_root)

Also available in: Unified diff