Skip to content

Draft: Sync code owner approval rules async

Hunter Stewart requested to merge hustewart-pb-timeout into master

What does this MR do and why?

Why

We are getting timeouts for Protected Branches creation API.

As pointed out by @vyaklushin in this comment we have code that is iterating over a project's merge requests and synchronously syncing the code owner approval rules.

We want to prevent these timeouts.

What

Sync code owner approval rules asynchronously.

This MR changes the sync from happening synchronously to asynchronously.

Considerations

It might make sense to eventually do some sort of batching approach to enqueue one job that can run these sync operations rather than enqueuing a job a for every MR on a project.

The most immediate trade off is that it will take longer to implement than this MR.

If the current approach works I'd prefer we create a new issue to move it into batching later so that we can mitigate the timeouts sooner.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

on master

  • Create a project
  • Protect a branch allowing maintainers and your root user to merge
  • Create a maintainer user in addition to the usual root admin user
  • Create an MR as the maintainer user
  • Verify you can see the merge button (you have the ability to merge as that maintainer, non admin user)
  • Update the protected branch rules so that only your root user can merge
  • Verify you can no longer see the merge button as the regular maintainer
  • Allow maintainers to merge again
  • Merge the MR as the maintainer

on hustewart-pb-timeout

  • make sure the behavior is the same
Edited by Hunter Stewart

Merge request reports

Loading