Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f3f9b99b
Commit
f3f9b99b
authored
Mar 10, 2020
by
Gary Holtz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modifies the transaction block a bit
parent
b7131fd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
app/services/merge_requests/post_merge_service.rb
app/services/merge_requests/post_merge_service.rb
+4
-6
No files found.
app/services/merge_requests/post_merge_service.rb
View file @
f3f9b99b
...
...
@@ -8,21 +8,19 @@ module MergeRequests
#
class
PostMergeService
<
MergeRequests
::
BaseService
def
execute
(
merge_request
)
# return if merge_request.merged? # nothing to do, this worker has already run at least once
# These operations need to happen transactionally
ActiveRecord
::
Base
.
transaction
(
requires_new:
true
)
do
merge_request
.
mark_as_merged
create_event
(
merge_request
)
create_note
(
merge_request
)
# TODO: Make sure these are async operations. If not, move them earlier
# Better to have duplicate notifications than no notifications.
# These options do not call external services and should be
# relatively quick enough to put in a Transaction
create_event
(
merge_request
)
todo_service
.
merge_merge_request
(
merge_request
,
current_user
)
notification_service
.
merge_mr
(
merge_request
,
current_user
)
end
# These operations are idempotent so can be safely run multiple times
create_note
(
merge_request
)
close_issues
(
merge_request
)
invalidate_cache_counts
(
merge_request
,
users:
merge_request
.
assignees
)
merge_request
.
update_project_counter_caches
...
...
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