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
27d21077
Commit
27d21077
authored
Mar 09, 2020
by
Gary Holtz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to put everything in the transaction block
parent
dc91d10c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
app/services/merge_requests/post_merge_service.rb
app/services/merge_requests/post_merge_service.rb
+8
-8
No files found.
app/services/merge_requests/post_merge_service.rb
View file @
27d21077
...
...
@@ -8,7 +8,7 @@ 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
#
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
do
...
...
@@ -20,7 +20,6 @@ module MergeRequests
# Better to have duplicate notifications than no notifications.
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
close_issues
(
merge_request
)
...
...
@@ -28,6 +27,7 @@ module MergeRequests
merge_request
.
update_project_counter_caches
delete_non_latest_diffs
(
merge_request
)
cleanup_environments
(
merge_request
)
end
# Anything after this point will be executed at-most-once. Less important activity only
# TODO: make all the work in here a separate sidekiq job so it can go in the transaction
...
...
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