From 9126bb34681719daab758e0013fdba2bcc3b2c4c Mon Sep 17 00:00:00 2001 From: yangzl Date: Wed, 27 Nov 2024 10:12:48 +0800 Subject: [PATCH] fix(portal): Fix the processing logic when the consumer obtains an empty quota --- .../framework/apollo/openapi/service/ConsumerService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java index cea61b02d88..9ab9e9d686d 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java @@ -56,6 +56,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import org.springframework.util.CollectionUtils; /** * @author Jason Song(song_s@ctrip.com) @@ -233,7 +234,11 @@ private boolean isAllowCreateApplication(Long consumerId) { } private Integer getRateLimit(Long consumerId) { - return getRateLimit(Collections.singletonList(consumerId)).get(0); + List list = getRateLimit(Collections.singletonList(consumerId)); + if(CollectionUtils.isEmpty(list)){ + return 0; + } + return list.get(0); } private List isAllowCreateApplication(List consumerIdList) {