Skip to content

Commit

Permalink
- Call quota update only if there are changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Oct 9, 2024
1 parent 7945f80 commit 1bb18a9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void execute(API createdAPI) throws AppException {
// Handle the system quota
List<QuotaRestriction> actualRestrictions = actualState != null ? getRestrictions(actualState.getSystemQuota()) : null;
List<QuotaRestriction> desiredRestrictions = getRestrictions(desiredState.getSystemQuota());

updateRestrictions(actualRestrictions, desiredRestrictions, createdAPI, Quota.SYSTEM_DEFAULT, sameAPI);
// Handle the application quota
actualRestrictions = actualState != null ? getRestrictions(actualState.getApplicationQuota()) : null;
Expand All @@ -57,6 +58,10 @@ public void updateRestrictions(List<QuotaRestriction> actualRestrictions, List<Q
LOG.info("{} quota for API: {} is UN-CHANGED. Nothing to do.", type.getFriendlyName(), createdAPI.getName());
return;
}
if(desiredRestrictions != null && desiredRestrictions.isEmpty()) {
LOG.info("{} quota for API: {} Nothing to do.", type.getFriendlyName(), createdAPI.getName());
return;
}
APIManagerAPIMethodAdapter methodAdapter = APIManagerAdapter.getInstance().getMethodAdapter();
APIManagerQuotaAdapter quotaManager = APIManagerAdapter.getInstance().getQuotaAdapter();
LOG.info("Updating {} quota for API: {}", type.getFriendlyName(), createdAPI.getName());
Expand Down

0 comments on commit 1bb18a9

Please sign in to comment.