Commit 1b74e49d authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-fetch-parallel' into 'master'

E2E: Fetch issue and mr comments in parallel threads

See merge request gitlab-org/gitlab!81597
parents 7857dc72 828b475c
...@@ -363,7 +363,7 @@ module QA ...@@ -363,7 +363,7 @@ module QA
imported_mrs = imported_project.merge_requests(auto_paginate: true, attempts: 2) imported_mrs = imported_project.merge_requests(auto_paginate: true, attempts: 2)
logger.debug("= Fetching merge request comments =") logger.debug("= Fetching merge request comments =")
imported_mrs.each_with_object({}) do |mr, mrs_with_comments| Parallel.map(imported_mrs, in_threads: 4) do |mr|
resource = Resource::MergeRequest.init do |resource| resource = Resource::MergeRequest.init do |resource|
resource.project = imported_project resource.project = imported_project
resource.iid = mr[:iid] resource.iid = mr[:iid]
...@@ -371,7 +371,7 @@ module QA ...@@ -371,7 +371,7 @@ module QA
end end
logger.debug("Fetching comments for mr '#{mr[:title]}'") logger.debug("Fetching comments for mr '#{mr[:title]}'")
mrs_with_comments[mr[:iid]] = { [mr[:iid], {
url: mr[:web_url], url: mr[:web_url],
title: mr[:title], title: mr[:title],
body: sanitize_description(mr[:description]) || '', body: sanitize_description(mr[:description]) || '',
...@@ -380,8 +380,8 @@ module QA ...@@ -380,8 +380,8 @@ module QA
# remove system notes # remove system notes
.reject { |c| c[:system] || c[:body].match?(/^(\*\*Review:\*\*)|(\*Merged by:).*/) } .reject { |c| c[:system] || c[:body].match?(/^(\*\*Review:\*\*)|(\*Merged by:).*/) }
.map { |c| sanitize_comment(c[:body]) } .map { |c| sanitize_comment(c[:body]) }
} }]
end end.to_h
end end
end end
...@@ -394,7 +394,7 @@ module QA ...@@ -394,7 +394,7 @@ module QA
imported_issues = imported_project.issues(auto_paginate: true, attempts: 2) imported_issues = imported_project.issues(auto_paginate: true, attempts: 2)
logger.debug("= Fetching issue comments =") logger.debug("= Fetching issue comments =")
imported_issues.each_with_object({}) do |issue, issues_with_comments| Parallel.map(imported_issues, in_threads: 4) do |issue|
resource = Resource::Issue.init do |issue_resource| resource = Resource::Issue.init do |issue_resource|
issue_resource.project = imported_project issue_resource.project = imported_project
issue_resource.iid = issue[:iid] issue_resource.iid = issue[:iid]
...@@ -402,15 +402,15 @@ module QA ...@@ -402,15 +402,15 @@ module QA
end end
logger.debug("Fetching comments for issue '#{issue[:title]}'") logger.debug("Fetching comments for issue '#{issue[:title]}'")
issues_with_comments[issue[:iid]] = { [issue[:iid], {
url: issue[:web_url], url: issue[:web_url],
title: issue[:title], title: issue[:title],
body: sanitize_description(issue[:description]) || '', body: sanitize_description(issue[:description]) || '',
comments: resource comments: resource
.comments(auto_paginate: true, attempts: 2) .comments(auto_paginate: true, attempts: 2)
.map { |c| sanitize_comment(c[:body]) } .map { |c| sanitize_comment(c[:body]) }
} }]
end end.to_h
end 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