Only use locking mechanism to prevent race condition in group member removal when removed group member is an owner
In Leverage existing locking mechanism to prevent ... (!96146 - merged) we introduced locking mechanism to prevent race conditions while removing owner of the groups.
This change however impacted users who are relying on parallel api calls to remove multiple members at a time as this causes Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
.
I realised we do not need locking at all if the removed member is NOT an owner. We can easily fix this by only applying locking mechanism for owners.
Availability and Testing
- Create a test script using the information provided in https://gitlab.com/gitlab-com/dev-sub-department/section-dev-request-for-help/-/issues/32 to delete multiple billable non-owner members simultaneously through the
DELETE /groups/:id/billable_members/:user_id
API in order to verify the fix resolves the error - Please also make sure to verify that the lock still works as expected when attempting to delete the last owner of a group as well when there is either one owner, or multiple owners
- An example of some scripts and test cases used in the original MR can be found here
- Feel free to reach out to
@vburton
if any testing assistance is needed
Edited by Valerie Burton