Browse Source
AI rule node: return early optimization in `deleteByTenantId()`
pull/13371/head
Dmytro Skarzhynets
1 year ago
No known key found for this signature in database
GPG Key ID: 2B51652F224037DF
1 changed files with
3 additions and
0 deletions
-
dao/src/main/java/org/thingsboard/server/dao/ai/AiSettingsServiceImpl.java
|
|
@ -118,6 +118,9 @@ class AiSettingsServiceImpl implements AiSettingsService { |
|
|
@Transactional |
|
|
@Transactional |
|
|
public void deleteByTenantId(TenantId tenantId) { |
|
|
public void deleteByTenantId(TenantId tenantId) { |
|
|
List<AiSettings> deletedSettings = aiSettingsDao.findAllByTenantId(tenantId, new PageLink(Integer.MAX_VALUE)).getData(); |
|
|
List<AiSettings> deletedSettings = aiSettingsDao.findAllByTenantId(tenantId, new PageLink(Integer.MAX_VALUE)).getData(); |
|
|
|
|
|
if (deletedSettings.isEmpty()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
aiSettingsDao.deleteByTenantId(tenantId); |
|
|
aiSettingsDao.deleteByTenantId(tenantId); |
|
|
deletedSettings.forEach(this::publishDeleteEvent); |
|
|
deletedSettings.forEach(this::publishDeleteEvent); |
|
|
} |
|
|
} |
|
|
|