Skip to content
代码片段 群组 项目
未验证 提交 dca62bec 编辑于 作者: Huzaifa Iftikhar's avatar Huzaifa Iftikhar 提交者: GitLab
浏览文件

Merge branch '437282-batch-groups' into 'master'

Batching subgroups in case of huge number of subgroups

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141444



Merged-by: default avatarHuzaifa Iftikhar <hiftikhar@gitlab.com>
Approved-by: default avatarSam Figueroa <sfigueroa@gitlab.com>
Approved-by: default avatarHuzaifa Iftikhar <hiftikhar@gitlab.com>
Co-authored-by: default avatarHitesh Raghuvanshi <hraghuvanshi@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -11,6 +11,8 @@ class Groups::AuditEventsController < Groups::ApplicationController ...@@ -11,6 +11,8 @@ class Groups::AuditEventsController < Groups::ApplicationController
before_action :check_audit_events_available! before_action :check_audit_events_available!
BATCH_SIZE = 100
track_event :index, track_event :index,
name: 'g_compliance_audit_events', name: 'g_compliance_audit_events',
action: 'visit_group_compliance_audit_events', action: 'visit_group_compliance_audit_events',
...@@ -29,15 +31,19 @@ def index ...@@ -29,15 +31,19 @@ def index
@audit_event_definitions = Gitlab::Audit::Type::Definition.names_with_category @audit_event_definitions = Gitlab::Audit::Type::Definition.names_with_category
@all_projects = [] @all_projects = []
group.all_projects_except_soft_deleted.each_batch do |projects| group.all_projects_except_soft_deleted.each_batch(of: BATCH_SIZE) do |projects|
projects_json = projects.map do |project| projects_json = projects.map do |project|
{ value: project.full_path, text: project.name, type: "Projects" } { value: project.full_path, text: project.name, type: "Projects" }
end end
@all_projects.concat(projects_json) @all_projects.concat(projects_json)
end end
@all_groups = group.descendants.map do |group| @all_groups = []
{ value: group.full_path, text: group.name, type: "Groups" } group.descendants.each_batch(of: BATCH_SIZE) do |groups|
groups_json = groups.map do |group|
{ value: group.full_path, text: group.name, type: "Groups" }
end
@all_groups.concat(groups_json)
end end
Gitlab::Tracking.event(self.class.name, 'search_audit_event', user: current_user, namespace: group) Gitlab::Tracking.event(self.class.name, 'search_audit_event', user: current_user, namespace: group)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册