Skip to content

Execute side effects of merge request approval async

Patrick Bajao requested to merge 10869-async-after-approval into master

What does this MR do and why?

Before this, MergeRequests::ApprovalService will execute a lot of SQL queries. When called with other services in a single web request, that can lead 100+ SQL queries in a single queries. That exceeds our query limit of 100.

This moves one of the side effects (event creation) of approvals to be performed async via Sidekiq. As a result, this reduces the number of SQL queries executed in the service since it's offloaded to Sidekiq. Other side effects will be moved in a separate MR.

Gitlab::EventStore is utilized to make it easier in the future to add side effects.

This is behind async_after_approval feature flag.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #10869 (closed)

Edited by Patrick Bajao

Merge request reports