Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NacosConnectionControlManagercheck方法中,并没有对totalCountLimit == -1这种特殊情况做不限制连接处理。 #12072

Closed
Happy-26 opened this issue May 9, 2024 · 0 comments
Labels
kind/enhancement Category issues or prs related to enhancement. plugin

Comments

@Happy-26
Copy link
Contributor

Happy-26 commented May 9, 2024

NacosConnectionControlManagercheck方法中,并没有对totalCountLimit == -1这种特殊情况做不限制连接处理。

@Override
public ConnectionCheckResponse check(ConnectionCheckRequest connectionCheckRequest) {
    ConnectionCheckResponse connectionCheckResponse = new ConnectionCheckResponse();
    connectionCheckResponse.setSuccess(true);
    connectionCheckResponse.setCode(ConnectionCheckCode.PASS_BY_TOTAL);
    int totalCountLimit = connectionControlRule.getCountLimit();
    // Get total connection from metrics
    Map<String, Integer> metricsTotalCount = metricsCollectorList.stream().collect(
            Collectors.toMap(ConnectionMetricsCollector::getName, ConnectionMetricsCollector::getTotalCount));
    int totalCount = metricsTotalCount.values().stream().mapToInt(Integer::intValue).sum();
    if (totalCount >= totalCountLimit) {
        connectionCheckResponse.setSuccess(false);
        connectionCheckResponse.setCode(ConnectionCheckCode.DENY_BY_TOTAL_OVER);
    }
    return connectionCheckResponse;
}
@KomachiSion KomachiSion added kind/enhancement Category issues or prs related to enhancement. plugin labels May 10, 2024
KomachiSion pushed a commit that referenced this issue May 15, 2024
…ntLimit is less than 0. (#12073)

* Fixed an issue where the maximum number of anti-fragile plug-ins implemented by default in Nacos is one more than the actual number of connections.

* bug fix : 修改删除空服务实例时,服务名和分组名没有正确解析的问题

* Update ConfigChangeAspect.java

修改configChangeRequest.setArg()的key为serviceType

* Update ConfigChangeAspect.java

* Update ConfigChangeRequest.java

* Update NacosConnectionControlManager.java

Add logic to not impose any limit when totalCountLimit equals -1.

* Update NacosConnectionControlManager.java

* Update NacosConnectionControlManagerTest.java

Add unit test cases when LimitCount is less than 0

* Update NacosConnectionControlManager.java

Modify comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement. plugin
Projects
None yet
Development

No branches or pull requests

2 participants