Skip to content

db: manually execute deletion of orphaned repos

Warren Gifford requested to merge core/manual-trigger-orphaned-repos into main

Created by: asdine

Orphaned repos cleanup is no longer triggered when we delete rows from external_service_repos. Instead, we manually run it when an external service is being deleted or after an external service sync.

Previously, we had a cyclical trigger:

  • External service is soft deleted
  • All associated rows in external_service_repo are deleted
    • (1) Trigger: Deletion of orphaned repos.
    • (2) Trigger: Deletion of associated rows in external_service_repos again
    • (1) Trigger: Deletion of orphaned repos again

When deleting a repo, we don't need to run (1) which is really slow because it needs to scan the whole repo table.

Part of: https://github.com/sourcegraph/customer/issues/263

Merge request reports

Loading