Skip to content

Use `AuthorizedProjectUpdate::ProjectRecalculateWorker` to refresh authorizations when a project is created

Manoj M J requested to merge mmj-new-worker-for-project-create into master

What does this MR do and why?

AuthorizedProjectRefresh::ProjectCreateWorker was introduced and used for refreshing authorizations when projects are created in !31377 (merged).

This worker worked only in a specific case (ie, on project creation only), so as to refresh its authorizations.

However, later we introduced AuthorizedProjectUpdate::ProjectRecalculateWorker, which is a specialized worker that can refresh the authorizations of any given project at any stage of its existence.

So, this means that we could very well use ProjectRecalculateWorker in place of the current ProjectCreateWorker and use the new worker to refresh authorization records to a project when it is created.

The advantage of this approach is that:

  • We move to a "single solution to refresh authorizations of a project, at any point of time in its existence", rather than using multiple solutions at different points in time.
  • Less code to maintain, as we can deprecate and remove ProjectCreateWorker and its associated code in the next major release (I've opened #344784 (closed) to do this in 15.0)

Performance comparison:

Metrics for both workers in the last 7 days:

  • AuthorizedProjectUpdate::ProjectRecalculateWorker (Link):
    • 50th, 95th and 99th percentile of json.duration_s - 0.044, 0.271, 0.865
  • AuthorizedProjectUpdate::ProjectCreateWorker (Link):
    • 50th, 95th and 99th percentile of json.duration_s - 0.057, 0.632, 1.822

So, AuthorizedProjectUpdate::ProjectRecalculateWorker has a slight edge in performance over AuthorizedProjectUpdate::ProjectCreateWorker as well.

(no changelog added as this is only a refactor)

Screenshots or screen recordings

How to set up and validate locally

MR acceptance checklist

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

Edited by Manoj M J

Merge request reports

Loading