Browse Source

chore: jenkins memory optimization

master
wangxiang 2 years ago
parent
commit
2efbb77736
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 10
      kicc-platform/kicc-platform-biz/kicc-system-biz/src/main/java/com/cloud/kicc/system/service/impl/ImContentServiceImpl.java

10
kicc-platform/kicc-platform-biz/kicc-system-biz/src/main/java/com/cloud/kicc/system/service/impl/ImContentServiceImpl.java

@ -222,20 +222,18 @@ public class ImContentServiceImpl extends ServiceImpl<ImContentMapper, ImContent @@ -222,20 +222,18 @@ public class ImContentServiceImpl extends ServiceImpl<ImContentMapper, ImContent
}
public void rateLimitRequestHandler() {
ZoneId chinaZoneId = ZoneId.of("Asia/Shanghai");
LocalDateTime startTime = LocalDateTime.now().minusSeconds(openAiConfigProperties.getDuration());
long startTimestamp = startTime.atZone(chinaZoneId).toEpochSecond();
LocalDateTime endTime = LocalDateTime.now();
LocalDateTime startTime = endTime.minusSeconds(openAiConfigProperties.getDuration());
// 查询当前用户在指定范围内的发送消息
long maxCount = super.count(Wrappers.<ImContent>lambdaQuery()
.eq(ImContent::getSendUserId, SecurityUtils.getCasUser().getId())
.between(ImContent::getSendTime, startTimestamp, LocalDateTime.now().atZone(chinaZoneId).toEpochSecond()));
.between(ImContent::getSendTime, startTime, endTime));
// 检查是否大于发送次数
if (StrUtil.equals(SecurityUtils.<KiccUser>getUser().getSubscriber(), SubscriberEnum.NON.getValue()) && maxCount > openAiConfigProperties.getNonMaxCount()) {
throw new CheckedException("普通订阅用户已超出当前最大速率限制,请过一会在试试!");
}
if (StrUtil.equals(SecurityUtils.<KiccUser>getUser().getSubscriber(), SubscriberEnum.BASIC.getValue()) && maxCount > openAiConfigProperties.getBasicMaxCount()) {
} else if (StrUtil.equals(SecurityUtils.<KiccUser>getUser().getSubscriber(), SubscriberEnum.BASIC.getValue()) && maxCount > openAiConfigProperties.getBasicMaxCount()) {
throw new CheckedException("基础订阅用户已超出当前最大速率限制,请过一会在试试!");
}
}

Loading…
Cancel
Save