Skip to content

Migrate user records to ghost in batch job runs

Imre Farkas requested to merge if-366655-migrate_to_ghost_worker into master

What does this MR do and why?

It splits Users::DestroyService into a 2 steps workflow:

  • keeps the first part of Users::DestroyService
  • migrating associated records to the ghost user and deleting records is migrated to Users::MigrateRecordsToGhostUserService

Migration and deletion is now done in batches asynchronously with a limited execution time:

  1. Users::MigrateRecordsToGhostUserInBatchesWorker is a cron worker running every minutes
  2. The worker executes Users::MigrateRecordsToGhostUserInBatchesService with execution time limit of 30 seconds
  3. Users::MigrateRecordsToGhostUserService is executed for each user

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/366655.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

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

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Imre Farkas

Merge request reports