Adjust default page size in query when listing pipelines
What does this MR do?
This change replaces the .per(30)
with .per(20)
so it is consistent with the page size when the list of pipelines is shown.
No user changes should be visible.
Sanity check
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 99a20a144f0..103989976a6 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -39,6 +39,21 @@ def index
.new(project, current_user, index_params)
.execute
.page(params[:page])
+ .per(30)
+
+ p 'to_sql: '
+ p Ci::PipelinesFinder
+ .new(project, current_user, index_params)
+ .execute
+ .page(params[:page])
+ .per(30)
+ .to_sql
+
+ p '@pipelines.length: '
+ p @pipelines.length
+
+ p 'serialize_pipelines: '
+ p serialize_pipelines.length
@pipelines_count = limited_pipelines_count(project)
Before
30 records are loaded, but only 20 are used.
2020-11-27_12:16:39.94282 rails-web : "to_sql: "
2020-11-27_12:16:39.94357 rails-web : "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"project_id\" = 27 AND \"ci_pipelines\".\"source\" != 12 ORDER BY \"ci_pipelines\".\"id\" DESC LIMIT 30 OFFSET 0"
2020-11-27_12:16:39.94360 rails-web : "@pipelines.length: "
2020-11-27_12:16:39.97755 rails-web : 30
2020-11-27_12:16:39.97759 rails-web : "serialize_pipelines: "
2020-11-27_12:16:40.87679 rails-web : 20
After
20 records are loaded.
2020-11-27_12:13:35.80297 rails-web : "to_sql: "
2020-11-27_12:13:35.80350 rails-web : "SELECT \"ci_pipelines\".* FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"project_id\" = 27 AND \"ci_pipelines\".\"source\" != 12 ORDER BY \"ci_pipelines\".\"id\" DESC LIMIT 20 OFFSET 0"
2020-11-27_12:13:35.80352 rails-web : "@pipelines.length: "
2020-11-27_12:13:35.80716 rails-web : 20
2020-11-27_12:13:35.80718 rails-web : "serialize_pipelines: "
2020-11-27_12:13:36.27775 rails-web : 20
Screenshots (strongly suggested)
No changes are expected, the page always loads 20 records.
This is the related page for reference http://gdk.test:3000/root/my-ci-variables/-/pipelines?page=1&scope=all
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #285125 (closed)
Edited by Miguel Rincon