Skip to content

insights: Fix for deleted users/orgs in oob settings migration

Administrator requested to merge insights/oob-deleted-user into main

Created by: CristinaBirkel

Fixes https://github.com/sourcegraph/sourcegraph/issues/29487

Description

Currently, the oob settings migration will get stuck on jobs for deleted users/orgs. This fix checks for those specific errors and marks the job completed in those cases.

I was a bit concerned about checking for hardcoded strings, but that code hasn't been modified in 3 years so it feels like it should be pretty stable. Plus this migration will be deprecated in the near future anyway, but let me know if you see a more robust way of checking for those!

Testing Steps

I tested this by:

  1. Add a couple of new job rows to insights_settings_migration_jobs: one with a user_id that doesn't exist, and one with an org_id that doesn't exist.
  2. Verify that without this fix, those rows get stuck on a not found error.
  3. Verify that with the fix, everything gets marked completed.

Merge request reports

Loading