API DELETE /users/:id takes minutes to effectively delete the user and imposes long delays in test environments

Problem to solve

User deletion with the API is asynchronous. In a test environment, using a freshly provisioned GitLab instance, it can take from one to five minutes.

It would speed up the test scripts if there was a way to require that the user deletion happens within shorter delays.

Steps to reproduce

Workaround

Versions

  • 16.11.0-ce.0
  • Self-managed

Run from:

    GITLAB_OMNIBUS_CONFIG="nginx['listen_https'] = false ; nginx['listen_port'] = 8181 ; external_url 'http://0.0.0.0:8181'; gitlab_rails['gitlab_shell_ssh_port'] = 2221;"
    docker run --name="test-gitlab" --shm-size=128M -d \
	   -e GITLAB_OMNIBUS_CONFIG="$GITLAB_OMNIBUS_CONFIG" \
	   -p 2221:22 -p 8181:8181 gitlab/gitlab-ce:16.11.0-ce.0

Maybe the users_migrate_records_to_ghost_user_in_batches_worker needs to be enqueued to speed things up?

I tried manually to

  • delete a user
  • trigger the cron
  • check the user is effectively deleted

I did it a few times to make sure I was not by chance doing that at the same time the cron was to be scheduled anyway. It effectively deleted the users.

This is where the user deletion became asynchronous. I wonder if there is a way to ask that it is immediate.

1 Like