diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-09 16:39:07 +0000 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-09 16:39:07 +0000 |
commit | 5e466627988823f8a77f84095892f3fd963d7a9e (patch) | |
tree | 3b70c4de9165363ab77931cf094ad243af2df263 /app/views | |
parent | e72ae40c95e170a6f7465ffffee1a3ad93be049a (diff) | |
parent | 9d9d2fbbc23e030416a6ebab556e87cf7014a057 (diff) | |
download | gitlab-ce-5e466627988823f8a77f84095892f3fd963d7a9e.tar.gz |
Merge branch 'commit-limits' into 'master'
Commit limits
Prevent timeouts when creating/viewing Merge Requests with many
commits. Also, reduce the number of commits shown in the UI from 500
to 100.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14031
This MR avoids Unicorn timeouts in some places and takes 4.5 seconds
off load times in others, when manually testing with a 4500-commit
compare/MR in the linux repo. It does not limit the number of Commit
objects instantiated in memory, just the amount of HTML generated. It
seems that having 4500 commits objects is not a problem in itself. If
it ever becomes one we could do something for Commit objects like we
did for Diff (introduce a CommitCollection or something).
See merge request !3095
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/commits/_commit_list.html.haml | 11 | ||||
-rw-r--r-- | app/views/projects/commits/_commits.html.haml | 8 |
2 files changed, 14 insertions, 5 deletions
diff --git a/app/views/projects/commits/_commit_list.html.haml b/app/views/projects/commits/_commit_list.html.haml index ce60fbdf032..bac9e244d36 100644 --- a/app/views/projects/commits/_commit_list.html.haml +++ b/app/views/projects/commits/_commit_list.html.haml @@ -1,11 +1,14 @@ +- commits, hidden = limited_commits(@commits) +- commits = Commit.decorate(commits, @project) + %div.panel.panel-default .panel-heading Commits (#{@commits.count}) - - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE + - if hidden > 0 %ul.well-list - - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE), @project).each do |commit| + - commits.each do |commit| = render "projects/commits/inline_commit", commit: commit, project: @project %li.warning-row.unstyled - other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues. + #{number_with_delimiter(hidden)} additional commits have been omitted to prevent performance issues. - else - %ul.well-list= render Commit.decorate(@commits, @project), project: @project + %ul.well-list= render commits, project: @project diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml index 6c631228002..a7e3c2478c2 100644 --- a/app/views/projects/commits/_commits.html.haml +++ b/app/views/projects/commits/_commits.html.haml @@ -1,7 +1,9 @@ - unless defined?(project) - project = @project -- @commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits| +- commits, hidden = limited_commits(@commits) + +- commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits| .row.commits-row .col-md-2.hidden-xs.hidden-sm %h5.commits-row-date @@ -13,3 +15,7 @@ %ul.bordered-list = render commits, project: project %hr.lists-separator + +- if hidden > 0 + .alert.alert-warning + #{number_with_delimiter(hidden)} additional commits have been omitted to prevent performance issues. |