summaryrefslogtreecommitdiff
path: root/app/services/merge_requests/create_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/merge_requests/create_service.rb')
-rw-r--r--app/services/merge_requests/create_service.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb
index 9303b0c4e51..04d08f257f1 100644
--- a/app/services/merge_requests/create_service.rb
+++ b/app/services/merge_requests/create_service.rb
@@ -14,11 +14,15 @@ module MergeRequests
end
def after_create(issuable)
- issuable.mark_as_preparing
+ current_user_id = current_user.id
+
+ issuable.run_after_commit do
+ # Add new items to MergeRequests::AfterCreateService if they can
+ # be performed in Sidekiq
+ NewMergeRequestWorker.perform_async(issuable.id, current_user_id)
+ end
- # Add new items to MergeRequests::AfterCreateService if they can
- # be performed in Sidekiq
- NewMergeRequestWorker.perform_async(issuable.id, current_user.id)
+ issuable.mark_as_preparing
super
end
@@ -64,4 +68,4 @@ module MergeRequests
end
end
-MergeRequests::CreateService.include_mod_with('MergeRequests::CreateService')
+MergeRequests::CreateService.prepend_mod_with('MergeRequests::CreateService')