|
@@ -221,6 +221,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
|
@@ -221,6 +221,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
221
|
|
221
|
|
222
|
@Override
|
222
|
@Override
|
223
|
public void onTenantProfileUpdate(TenantProfileId tenantProfileId) {
|
223
|
public void onTenantProfileUpdate(TenantProfileId tenantProfileId) {
|
|
|
224
|
+ log.info("[{}] On Tenant Profile Update", tenantProfileId);
|
224
|
TenantProfile tenantProfile = tenantProfileCache.get(tenantProfileId);
|
225
|
TenantProfile tenantProfile = tenantProfileCache.get(tenantProfileId);
|
225
|
updateLock.lock();
|
226
|
updateLock.lock();
|
226
|
try {
|
227
|
try {
|
|
@@ -236,6 +237,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
|
@@ -236,6 +237,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
236
|
|
237
|
|
237
|
@Override
|
238
|
@Override
|
238
|
public void onTenantUpdate(TenantId tenantId) {
|
239
|
public void onTenantUpdate(TenantId tenantId) {
|
|
|
240
|
+ log.info("[{}] On Tenant Update", tenantId);
|
239
|
TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
|
241
|
TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
|
240
|
updateLock.lock();
|
242
|
updateLock.lock();
|
241
|
try {
|
243
|
try {
|
|
@@ -248,16 +250,17 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService { |
|
@@ -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
|
TenantProfileData oldProfileData = state.getTenantProfileData();
|
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
|
Map<ApiFeature, ApiUsageStateValue> result = state.checkStateUpdatedDueToThresholds();
|
258
|
Map<ApiFeature, ApiUsageStateValue> result = state.checkStateUpdatedDueToThresholds();
|
256
|
if (!result.isEmpty()) {
|
259
|
if (!result.isEmpty()) {
|
257
|
persistAndNotify(state, result);
|
260
|
persistAndNotify(state, result);
|
258
|
}
|
261
|
}
|
259
|
updateProfileThresholds(state.getTenantId(), state.getApiUsageState().getId(),
|
262
|
updateProfileThresholds(state.getTenantId(), state.getApiUsageState().getId(),
|
260
|
- oldProfileData.getConfiguration(), tenantProfile.getProfileData().getConfiguration());
|
263
|
+ oldProfileData.getConfiguration(), profile.getProfileData().getConfiguration());
|
261
|
}
|
264
|
}
|
262
|
|
265
|
|
263
|
private void updateProfileThresholds(TenantId tenantId, ApiUsageStateId id,
|
266
|
private void updateProfileThresholds(TenantId tenantId, ApiUsageStateId id,
|