diff options
Diffstat (limited to 'app/services/post_receive_service.rb')
-rw-r--r-- | app/services/post_receive_service.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/services/post_receive_service.rb b/app/services/post_receive_service.rb index a6d49f03c0b..f5638b0aa40 100644 --- a/app/services/post_receive_service.rb +++ b/app/services/post_receive_service.rb @@ -17,13 +17,18 @@ class PostReceiveService response = Gitlab::InternalPostReceive::Response.new push_options = Gitlab::PushOptions.new(params[:push_options]) + mr_options = push_options.get(:merge_request) response.reference_counter_decreased = Gitlab::ReferenceCounter.new(params[:gl_repository]).decrease + # The PostReceive worker will normally invalidate the cache. However, it + # runs asynchronously. If push options require us to create a new merge + # request synchronously, we can't rely on that, so invalidate the cache here + repository&.expire_branches_cache if mr_options&.fetch(:create, false) + PostReceive.perform_async(params[:gl_repository], params[:identifier], params[:changes], push_options.as_json) - mr_options = push_options.get(:merge_request) if mr_options.present? message = process_mr_push_options(mr_options, params[:changes]) response.add_alert_message(message) |