Move non-production code out of lib/
We're eagerly loading everything under lib/*
in production, so we should avoid putting anything which will not be used in production out of lib/*
, because that'll increase memory footprint and booting time unnecessarily.
This includes:
-
lib/quality/helm_client.rb
which is used inscripts/review_apps/automated_cleanup.rb
-
lib/quality/kubernetes_client.rb
which is used inscripts/review_apps/automated_cleanup.rb
-
lib/quality/
-
lib/quality/test_level.rb
!53696 (merged) -
lib/gitlab/danger/
!51566 (merged) -
lib/gitlab_danger
!51566 (merged) -
lib/rspec_flaky
!53283 (merged) -
lib/gitlab/graphql/docs/
-
lib/generators
# Assuming Rails default -
lib/peek
# I think this is needed under development? - [-]
lib/tasks
# No Ruby files here, but ruby classes inside .rake files -
more?
The following discussion from !28768 (merged) should be addressed:
-
@godfat started a discussion: (+2 comments) I see that we're already doing this for
Quality::HelmClient
but I think it's probably worth to mention it. We're eagerly loading everything underlib
on production:config.eager_load_paths.push(*%W[#{config.root}/lib # ...
(can be found in
config/application.rb
)And I just checked running console under production mode, it did load the helm client, and this is going to add up memory footprint and slowing down application booting time.
We should consider move them into another directory, like maybe under
script
.