Class: Pages::DeleteGroupPagesDeploymentsWorker
Instance Method Summary
collapse
#handle_event_in, #perform
Instance Method Details
#handle_event(event) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/workers/pages/delete_group_pages_deployments_worker.rb', line 11
def handle_event(event)
group_id = event.data[:group_id]
return unless group_id
group = Group.find_by_id(group_id)
return unless group
cursor = { current_id: group_id, depth: [group_id] }
iterator = Gitlab::Database::NamespaceEachBatch.new(namespace_class: Namespace, cursor: cursor)
iterator.each_batch(of: 100) do |namespace_ids, _new_cursor|
project_namespaces = Namespaces::ProjectNamespace.id_in(namespace_ids)
projects_with_pages(project_namespaces).each do |project|
user = project.owner
next unless user
::Pages::DeleteService.new(project, user).execute
end
end
end
|