Skip to content

Commit

Permalink
Fix review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
shilmyhasan committed Dec 14, 2023
1 parent ef80da6 commit 407a5bc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,10 @@ private void initThrottleForApplicationLevelSpikeArrest(MessageContext synCtx,

if (createApplicationLevelSpikeArrestPolicy) {
synchronized (authenticationContext.getSubscriberTenantDomain() +
authenticationContext.getApplicationTier().intern()) {
authenticationContext.getApplicationTier().intern() + "_appSpikeArrest") {

Check warning on line 920 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java#L919-L920

Added lines #L919 - L920 were not covered by tests
if (throttle.getThrottleContext(applicationLevelThrottleKey) != null) {
return;

Check warning on line 922 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java#L922

Added line #L922 was not covered by tests
}
OMElement spikeArrestApplicationLevelPolicy = createSpikeArrestApplicationLevelPolicy(

Check warning on line 924 in components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/throttling/ThrottleHandler.java#L924

Added line #L924 was not covered by tests
applicationLevelThrottleKey, maxRequestCount, applicationSpikeArrestWindowUnitTime);
if (spikeArrestApplicationLevelPolicy != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ public class APIKeyValidationInfoDTO implements Serializable {
//should be its first element.
private List<String> throttlingDataList;
private int spikeArrestLimit;



private int applicationSpikeArrestLimit;
private String subscriberTenantDomain;
private String spikeArrestUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,32 @@
import org.wso2.carbon.apimgt.api.model.subscription.Subscription;
import org.wso2.carbon.apimgt.api.model.subscription.SubscriptionPolicy;
import org.wso2.carbon.apimgt.api.model.subscription.URLMapping;
import org.wso2.carbon.apimgt.internal.service.dto.*;
import org.wso2.carbon.apimgt.internal.service.dto.APIDTO;
import org.wso2.carbon.apimgt.internal.service.dto.APIListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApiPolicyConditionGroupDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApiPolicyDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApiPolicyListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApplicationDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApplicationKeyMappingDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApplicationKeyMappingListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApplicationListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApplicationPolicyDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ApplicationPolicyListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.BandwidthLimitDTO;
import org.wso2.carbon.apimgt.internal.service.dto.BurstLimitDTO;
import org.wso2.carbon.apimgt.internal.service.dto.EventCountLimitDTO;
import org.wso2.carbon.apimgt.internal.service.dto.GlobalPolicyDTO;
import org.wso2.carbon.apimgt.internal.service.dto.GlobalPolicyListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.GroupIdDTO;
import org.wso2.carbon.apimgt.internal.service.dto.RequestCountLimitDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ScopeDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ScopesListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.SubscriptionDTO;
import org.wso2.carbon.apimgt.internal.service.dto.SubscriptionListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.SubscriptionPolicyDTO;
import org.wso2.carbon.apimgt.internal.service.dto.SubscriptionPolicyListDTO;
import org.wso2.carbon.apimgt.internal.service.dto.ThrottleLimitDTO;
import org.wso2.carbon.apimgt.internal.service.dto.URLMappingDTO;
import org.wso2.carbon.apimgt.rest.api.common.RestApiCommonUtil;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;

Expand Down

0 comments on commit 407a5bc

Please sign in to comment.