Skip to content

Add migrations_should_finish on elastic_index_dependant_association

What does this MR do and why?

This MR adds a dependency migrations_should_finish on elastic_index_dependant_association. We can pass an array of the migrations which we should be completed before indexing the association. If we don't pass anything it will neglect this dependency.

Screenshots or screen recordings

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. In the file ee/app/models/ee/project.rb edit the line elastic_index_dependant_association :notes, on_change: :visibility_level to elastic_index_dependant_association :notes, on_change: :visibility_level, migrations_should_finish: ['abc']
  2. Open the rails console
bundle exec rails c
  1. Open the sidekiq on terminal
sidekiq
  1. Set a new visibility_level for any project on the rails console
Project.first.update visibility_level: 10
  1. Verify on the sidekiq terminal that ElasticAssociationIndexerWorker is called only for issues and merge_request not for notes

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

Edited by Ravi Kumar

Merge request reports

Loading