AI rule node: return early optimization in deleteByTenantId()

This commit is contained in:
Dmytro Skarzhynets 2025-05-23 14:48:47 +03:00
parent b902c0029d
commit c738d3a906
No known key found for this signature in database
GPG Key ID: 2B51652F224037DF

View File

@ -118,6 +118,9 @@ class AiSettingsServiceImpl implements AiSettingsService {
@Transactional
public void deleteByTenantId(TenantId tenantId) {
List<AiSettings> deletedSettings = aiSettingsDao.findAllByTenantId(tenantId, new PageLink(Integer.MAX_VALUE)).getData();
if (deletedSettings.isEmpty()) {
return;
}
aiSettingsDao.deleteByTenantId(tenantId);
deletedSettings.forEach(this::publishDeleteEvent);
}