Skip to content

Background worker for suggested reviewers

What does this MR do and why?

Backrground worker for suggested reviewers service

Why jsonb in merge requests table

The reviewers are calculated using machine learning inference.

  • We don't call the service online from gitlab as it can take a long time > 1 second and it's not observed.
  • A jsonb column is a good choice for pre-fetched values because it scales better than redis as we rollout to projects.
  • Also the schema can change with new machine learning improvements.

Migration

$ bin/rails db:migrate:up:main VERSION=20220915140802
main: == 20220915140802 CreateMergeRequestPredictions: migrating ====================
main: -- create_table(:merge_request_predictions, {:id=>false})
main:    -> 0.0102s
main: == 20220915140802 CreateMergeRequestPredictions: migrated (0.0106s) ===========

$ bin/rails db:migrate:down:main VERSION=20220915140802
main: == 20220915140802 CreateMergeRequestPredictions: reverting ====================
main: -- drop_table(:merge_request_predictions)
main:    -> 0.0022s
main: == 20220915140802 CreateMergeRequestPredictions: reverted (0.0026s) ===========

How to set up and validate locally

mr = MergeRequest.last
MergeRequests::FetchSuggestedReviewersWorker.new.perform(mr.id)

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 #373173 (closed)

Edited by Alper Akgun

Merge request reports

Loading