mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 11:18:26 +08:00
bf3e121323
Why this change? When running system tests on our CI, we have been occasionally seeing server errors like: ``` Error encountered while proccessing /stylesheets/desktop_e58cf7f686aab173f9b778797f241913c2833c39.css NoMethodError: undefined method `+' for nil:NilClass /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/path/pattern.rb:139:in `[]' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:127:in `block (2 levels) in find_routes' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `each' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `each_with_index' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:126:in `block in find_routes' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:123:in `map!' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:123:in `find_routes' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/journey/router.rb:32:in `serve' /__w/discourse/discourse/vendor/bundle/ruby/3.2.0/gems/actionpack-7.0.7/lib/action_dispatch/routing/route_set.rb:852:in `call' ``` While looking through various Rails issues related to the error above, I came across https://github.com/rails/rails/pull/27647 which is a fix to fully initialize routes before the first request is handled. However, the routes are only fully initialize only if `config.eager_load` is set to `true`. There is no reason why `config.eager_load` shouldn't be `true` in the CI environment and this is what a new Rails 7.1 app is generated with. What does this change do? Enable `config.eager_load` when `env["CI"]` is present |
||
---|---|---|
.. | ||
admin | ||
users | ||
about_controller.rb | ||
application_controller.rb | ||
associated_groups_controller.rb | ||
badges_controller.rb | ||
bookmarks_controller.rb | ||
bootstrap_controller.rb | ||
categories_controller.rb | ||
clicks_controller.rb | ||
composer_controller.rb | ||
composer_messages_controller.rb | ||
csp_reports_controller.rb | ||
directory_columns_controller.rb | ||
directory_items_controller.rb | ||
do_not_disturb_controller.rb | ||
drafts_controller.rb | ||
edit_directory_columns_controller.rb | ||
email_controller.rb | ||
embed_controller.rb | ||
exceptions_controller.rb | ||
export_csv_controller.rb | ||
extra_locales_controller.rb | ||
finish_installation_controller.rb | ||
form_templates_controller.rb | ||
forums_controller.rb | ||
groups_controller.rb | ||
hashtags_controller.rb | ||
highlight_js_controller.rb | ||
inline_onebox_controller.rb | ||
invites_controller.rb | ||
list_controller.rb | ||
metadata_controller.rb | ||
new_topic_controller.rb | ||
notifications_controller.rb | ||
offline_controller.rb | ||
onebox_controller.rb | ||
permalinks_controller.rb | ||
post_action_users_controller.rb | ||
post_actions_controller.rb | ||
post_readers_controller.rb | ||
posts_controller.rb | ||
presence_controller.rb | ||
published_pages_controller.rb | ||
push_notification_controller.rb | ||
qunit_controller.rb | ||
reviewable_claimed_topics_controller.rb | ||
reviewables_controller.rb | ||
robots_txt_controller.rb | ||
safe_mode_controller.rb | ||
search_controller.rb | ||
session_controller.rb | ||
sidebar_sections_controller.rb | ||
similar_topics_controller.rb | ||
site_controller.rb | ||
sitemap_controller.rb | ||
slugs_controller.rb | ||
static_controller.rb | ||
steps_controller.rb | ||
stylesheets_controller.rb | ||
svg_sprite_controller.rb | ||
tag_groups_controller.rb | ||
tags_controller.rb | ||
theme_javascripts_controller.rb | ||
topics_controller.rb | ||
uploads_controller.rb | ||
user_actions_controller.rb | ||
user_api_keys_controller.rb | ||
user_avatars_controller.rb | ||
user_badges_controller.rb | ||
user_status_controller.rb | ||
users_controller.rb | ||
users_email_controller.rb | ||
webhooks_controller.rb | ||
wizard_controller.rb |