Commit 471b9888 authored by Stan Hu's avatar Stan Hu

Merge branch '197346-load-initializers-after-zeitwerk' into 'master'

Fix deprecation messages due to autoloading in initializers

Closes #197346

See merge request gitlab-org/gitlab!24994
parents 2b5df1e7 24bd017f
...@@ -285,6 +285,13 @@ module Gitlab ...@@ -285,6 +285,13 @@ module Gitlab
g.factory_bot false g.factory_bot false
end end
# This empty initializer forces the :let_zeitwerk_take_over initializer to run before we load
# initializers in config/initializers. This is done because autoloading before Zeitwerk takes
# over is deprecated but our initializers do a lot of autoloading.
# See https://gitlab.com/gitlab-org/gitlab/issues/197346 for more details
initializer :move_initializers, before: :load_config_initializers, after: :let_zeitwerk_take_over do
end
config.after_initialize do config.after_initialize do
Rails.application.reload_routes! Rails.application.reload_routes!
......
require 'gitlab/testing/request_blocker_middleware'
require 'gitlab/testing/request_inspector_middleware'
Rails.application.configure do Rails.application.configure do
# Make sure the middleware is inserted first in middleware chain # Make sure the middleware is inserted first in middleware chain
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestBlockerMiddleware) config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestBlockerMiddleware)
......
...@@ -6,8 +6,6 @@ GraphQL::Field.accepts_definitions(authorize: GraphQL::Define.assign_metadata_ke ...@@ -6,8 +6,6 @@ GraphQL::Field.accepts_definitions(authorize: GraphQL::Define.assign_metadata_ke
GraphQL::Schema::Object.accepts_definition(:authorize) GraphQL::Schema::Object.accepts_definition(:authorize)
GraphQL::Schema::Field.accepts_definition(:authorize) GraphQL::Schema::Field.accepts_definition(:authorize)
Gitlab::Application.config.after_initialize do GitlabSchema.middleware << GraphQL::Schema::TimeoutMiddleware.new(max_seconds: Gitlab.config.gitlab.graphql_timeout) do |timeout_error, query|
GitlabSchema.middleware << GraphQL::Schema::TimeoutMiddleware.new(max_seconds: Gitlab.config.gitlab.graphql_timeout) do |timeout_error, query| Gitlab::GraphqlLogger.error(message: timeout_error.to_s, query: query.query_string, query_variables: query.provided_variables)
Gitlab::GraphqlLogger.error(message: timeout_error.to_s, query: query.query_string, query_variables: query.provided_variables)
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment