Skip to content

GitLab Migration: Add cron job to mark imports as failed after a certain amount of time

Add a safeguard mechanism to GitLab Migration to clean up any of the 'in progress' / stuck imports in order to mark them as failed after a certain amount of time.

We have something similar for file-based Import/Export Gitlab::Import::StuckImportJob https://gitlab.com/gitlab-org/gitlab/blob/62deba86fd7822d070300d6bea27a48162aecaab/app/workers/gitlab/import/stuck_import_job.rb#L5-L5

Related to the discussion in https://gitlab.com/gitlab-org/manage/import/support/-/issues/8

Implementation Proposal

  • Create new scope stale on BulkImport and BulkImports::Entity models.
    • This should return records that are over 1 day(?) old and are either created or started.
  • Create new worker that scans for all stale records and marks them are failed .fail_op.
  • Assign worker to cron and run once per day.
Edited by Max Woolf