Improve performance of PR import
What does this MR do?
The merge_requests.reload.find
makes AR to load ALL Merge Requests for given project.
This results in PullRequestImporter
to have O(n)
complexity and memory pressure
(n - number of already imported PR).
The .reload
is not needed as the .find
always perform SQL query to find given object.
After that change importing pull requests from https://github.com/gitlabhq/gitlabhq have the very constant time between 0.01-1s for me, instead of 10-40s at the end of the process.
This happens for the following reason:
Conformity
Performance and testing
If cross-browser testing is not required, please remove the relevant item, or mark it as not needed: [-] -->
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Edited by Kamil Trzciński