Fix #11700: While doing recursive delete, check if a previous iteration already deleted the children (#14629)

This commit is contained in:
Sriharsha Chintalapani 2024-01-08 22:09:45 -08:00 committed by GitHub
parent 3b61938c6d
commit 9cafde3847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -467,7 +467,12 @@ public final class Entity {
public static void deleteEntity( public static void deleteEntity(
String updatedBy, String entityType, UUID entityId, boolean recursive, boolean hardDelete) { String updatedBy, String entityType, UUID entityId, boolean recursive, boolean hardDelete) {
EntityRepository<?> dao = getEntityRepository(entityType); EntityRepository<?> dao = getEntityRepository(entityType);
dao.delete(updatedBy, entityId, recursive, hardDelete); try {
dao.find(entityId, Include.ALL);
dao.delete(updatedBy, entityId, recursive, hardDelete);
} catch (EntityNotFoundException e) {
LOG.warn("Entity {} is already deleted.", entityId);
}
} }
public static void restoreEntity(String updatedBy, String entityType, UUID entityId) { public static void restoreEntity(String updatedBy, String entityType, UUID entityId) {