Bug #25876
closedRace condition on removing multiple organizations simultaneously
Description
Description of problem:
Hitting db constraints when trying to delete multiple organizations at the same time.
LANG=en_US.UTF-8 hammer -v -u admin -p changeme organization delete --name="\xe9\xbe\xa3\xe9\xbc\x84\xe8\xbe\xbd\xe6\x98\xb4"
Task ef128feb-1d73-4161-81c8-731d6b64789a planned: 0.0/1, 0%, elapsed: 00:00:00
Task ef128feb-1d73-4161-81c8-731d6b64789a running: 0.9090909090909091/1, 90%, 0.4/s, elapsed: 00:00:02
Task ef128feb-1d73-4161-81c8-731d6b64789a error: 0.9545454545454546/1, 95%, 0.2/s, elapsed: 00:00:04
Task ef128feb-1d73-4161-81c8-731d6b64789a error: 0.9545454545454546/1, 95%, 0.2/s, elapsed: 00:00:04
Error: PG::ForeignKeyViolation: ERROR: update or delete on table "taxonomies" violates foreign key constraint "taxable_taxonomies_taxonomy_id_fk" on table "taxable_taxonomies"
DETAIL: Key (id)=(28) is still referenced from table "taxable_taxonomies".
: DELETE FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = $1
Steps to Reproduce:
Try to delete multiple organizations at the same time. Not reproducible each time due to the nature of the bug.