BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
722d8073
Unverified
Commit
722d8073
authored
Nov 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent big amount of sql queries for push service
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
53f05343
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
git_push_service.rb
app/services/git_push_service.rb
+14
-4
No files found.
app/services/git_push_service.rb
View file @
722d8073
...
...
@@ -83,9 +83,14 @@ class GitPushService
# closing regex. Exclude any mentioned Issues from cross-referencing even if the commits are being pushed to
# a different branch.
issues_to_close
=
commit
.
closes_issues
(
project
)
author
=
commit_user
(
commit
)
if
!
issues_to_close
.
empty?
&&
is_default_branch
# Load commit author only if needed.
# For push with 1k commits it prevents 900+ requests in database
author
=
nil
if
issues_to_close
.
present?
&&
is_default_branch
author
||=
commit_user
(
commit
)
issues_to_close
.
each
do
|
issue
|
Issues
::
CloseService
.
new
(
project
,
author
,
{}).
execute
(
issue
,
commit
)
end
...
...
@@ -96,8 +101,13 @@ class GitPushService
# being pushed to a different branch).
refs
=
commit
.
references
(
project
)
-
issues_to_close
refs
.
reject!
{
|
r
|
commit
.
has_mentioned?
(
r
)
}
refs
.
each
do
|
r
|
Note
.
create_cross_reference_note
(
r
,
commit
,
author
,
project
)
if
refs
.
present?
author
||=
commit_user
(
commit
)
refs
.
each
do
|
r
|
Note
.
create_cross_reference_note
(
r
,
commit
,
author
,
project
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment