Fix worker when record not found

What does this MR do and why?

Found when reviewing error budget violations in https://gitlab.com/gitlab-org/search-team/team-tasks/-/issues/181#note_1993449610

If indexing is paused for a long time, it's possible that workers are queued and the objects they are queued for are deleted.

The worker would fail currently. This MR makes the following changes:

  • handle records not found and return early
  • update specs
  • remove a few rubocop todos

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

N/A

How to set up and validate locally

  1. setup gdk for elasticsearch
  2. in rails console, run the worker on a non existent record and validate that it does not raise an error
ElasticAssociationIndexerWorker.new.perform('Project', 0, :issues)
Edited by Terri Chu

Merge request reports

Loading