We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
public LocalSimpleCountRateCounter(String name, TimeUnit period) { super(name, period); slotList = new ArrayList<>(DEFAULT_RECORD_SIZE); for (int i = 0; i < DEFAULT_RECORD_SIZE; i++) { slotList.add(new TpsSlot()); } long now = System.currentTimeMillis(); if (period == TimeUnit.SECONDS) { startTime = RateCounter.getTrimMillsOfSecond(now); } else if (period == TimeUnit.MINUTES) { startTime = RateCounter.getTrimMillsOfMinute(now); } else if (period == TimeUnit.HOURS) { startTime = RateCounter.getTrimMillsOfHour(now); } else { //有bug getTrimMillsOfSecond(now); } }
除了这里还有:SlotCountHolder 中的interceptedCount 总是0
static class SlotCountHolder {
AtomicLong count = new AtomicLong(); AtomicLong interceptedCount = new AtomicLong(); @Override public String toString() { return "{" + count + "|" + interceptedCount + '}'; } }
注: SimpleCountRuleBarrier并没有处理interceptedCount @OverRide public TpsCheckResponse applyTps(BarrierCheckRequest barrierCheckRequest) { long count = rateCounter.getCount(barrierCheckRequest.getTimestamp()); long maxCount = getMaxCount(); if (MonitorType.INTERCEPT.getType().equals(getMonitorType()) && maxCount >= 0 && count >= maxCount) { return new TpsCheckResponse(false, TpsResultCode.DENY_BY_POINT, "tps over limit :" + maxCount); } rateCounter.add(barrierCheckRequest.getTimestamp(), barrierCheckRequest.getCount()); return new TpsCheckResponse(true, TpsResultCode.PASS_BY_POINT, "success"); }
The text was updated successfully, but these errors were encountered:
#11625
Sorry, something went wrong.
@i will solve it@
[ISSUES #11626] 优化Nacos的默认反脆弱插件 (#11625)
1710fa3
* Update LocalSimpleCountRateCounter.java fixbug * Update LocalSimpleCountRateCounter.java bugfix * fix:默认的nacos反脆弱插件的问题 * fix:默认的nacos反脆弱插件的问题 * fix:默认的nacos反脆弱插件的问题 * fix:默认的nacos反脆弱插件的问题 * fix:默认的nacos反脆弱插件的问题,调整为tryAdd * fix:默认的nacos反脆弱插件的问题,调整为tryAdd * 调整测试方式,保障流水线成功
floor07
No branches or pull requests
除了这里还有:SlotCountHolder 中的interceptedCount 总是0
static class SlotCountHolder {
注:
SimpleCountRuleBarrier并没有处理interceptedCount
@OverRide
public TpsCheckResponse applyTps(BarrierCheckRequest barrierCheckRequest) {
long count = rateCounter.getCount(barrierCheckRequest.getTimestamp());
long maxCount = getMaxCount();
if (MonitorType.INTERCEPT.getType().equals(getMonitorType()) && maxCount >= 0 && count >= maxCount) {
return new TpsCheckResponse(false, TpsResultCode.DENY_BY_POINT, "tps over limit :" + maxCount);
}
rateCounter.add(barrierCheckRequest.getTimestamp(), barrierCheckRequest.getCount());
return new TpsCheckResponse(true, TpsResultCode.PASS_BY_POINT, "success");
}
The text was updated successfully, but these errors were encountered: