Showing
3 changed files
with
8 additions
and
5 deletions
application/src/main/java/org/thingsboard/server/service/apiusage/DefaultTbApiUsageStateService.java
... | ... | @@ -221,6 +221,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
221 | 221 | |
222 | 222 | @Override |
223 | 223 | public void onTenantProfileUpdate(TenantProfileId tenantProfileId) { |
224 | + log.info("[{}] On Tenant Profile Update", tenantProfileId); | |
224 | 225 | TenantProfile tenantProfile = tenantProfileCache.get(tenantProfileId); |
225 | 226 | updateLock.lock(); |
226 | 227 | try { |
... | ... | @@ -236,6 +237,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
236 | 237 | |
237 | 238 | @Override |
238 | 239 | public void onTenantUpdate(TenantId tenantId) { |
240 | + log.info("[{}] On Tenant Update", tenantId); | |
239 | 241 | TenantProfile tenantProfile = tenantProfileCache.get(tenantId); |
240 | 242 | updateLock.lock(); |
241 | 243 | try { |
... | ... | @@ -248,16 +250,17 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
248 | 250 | } |
249 | 251 | } |
250 | 252 | |
251 | - private void updateTenantState(TenantApiUsageState state, TenantProfile tenantProfile) { | |
253 | + private void updateTenantState(TenantApiUsageState state, TenantProfile profile) { | |
254 | + log.info("[{}] On Tenant Update.", state.getTenantId()); | |
252 | 255 | TenantProfileData oldProfileData = state.getTenantProfileData(); |
253 | - state.setTenantProfileId(tenantProfile.getId()); | |
254 | - state.setTenantProfileData(tenantProfile.getProfileData()); | |
256 | + state.setTenantProfileId(profile.getId()); | |
257 | + state.setTenantProfileData(profile.getProfileData()); | |
255 | 258 | Map<ApiFeature, ApiUsageStateValue> result = state.checkStateUpdatedDueToThresholds(); |
256 | 259 | if (!result.isEmpty()) { |
257 | 260 | persistAndNotify(state, result); |
258 | 261 | } |
259 | 262 | updateProfileThresholds(state.getTenantId(), state.getApiUsageState().getId(), |
260 | - oldProfileData.getConfiguration(), tenantProfile.getProfileData().getConfiguration()); | |
263 | + oldProfileData.getConfiguration(), profile.getProfileData().getConfiguration()); | |
261 | 264 | } |
262 | 265 | |
263 | 266 | private void updateProfileThresholds(TenantId tenantId, ApiUsageStateId id, | ... | ... |
... | ... | @@ -274,6 +274,7 @@ public class DefaultTbClusterService implements TbClusterService { |
274 | 274 | TbQueueProducer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> toRuleEngineProducer = producerProvider.getRuleEngineNotificationsMsgProducer(); |
275 | 275 | Set<String> tbRuleEngineServices = new HashSet<>(partitionService.getAllServiceIds(ServiceType.TB_RULE_ENGINE)); |
276 | 276 | if (msg.getEntityId().getEntityType().equals(EntityType.TENANT) |
277 | + || msg.getEntityId().getEntityType().equals(EntityType.TENANT_PROFILE) | |
277 | 278 | || msg.getEntityId().getEntityType().equals(EntityType.DEVICE_PROFILE) |
278 | 279 | || msg.getEntityId().getEntityType().equals(EntityType.API_USAGE_STATE)) { |
279 | 280 | TbQueueProducer<TbProtoQueueMsg<ToCoreNotificationMsg>> toCoreNfProducer = producerProvider.getTbCoreNotificationsMsgProducer(); | ... | ... |