解决nacos异常,发送客户端当只有空格是不推送
This commit is contained in:
parent
ac23efe3a0
commit
62fba7e356
@ -75,6 +75,12 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||||
|
<artifactId>caffeine</artifactId>
|
||||||
|
<version>3.1.8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@ -134,14 +134,18 @@ public class BaseWebSocketProcess {
|
|||||||
int m = Math.max(Math.max(Math.max(Math.max(d, j), Math.max(a, b)), c), n);
|
int m = Math.max(Math.max(Math.max(Math.max(d, j), Math.max(a, b)), c), n);
|
||||||
if (m > 0) {
|
if (m > 0) {
|
||||||
//清空
|
//清空
|
||||||
sb.setLength(0);
|
String msg = old.substring(0, m);
|
||||||
sb.append(old.substring(m));
|
if(msg.replace(" ", "").length() > 0){
|
||||||
old = old.substring(0, m);
|
//纯空格的不推送
|
||||||
|
sb.setLength(0);
|
||||||
|
sb.append(old.substring(m));
|
||||||
|
|
||||||
|
normalSendMsg(baseSession, msg, type, YesNo.NO.getCode());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
normalSendMsg(baseSession, old, type, YesNo.NO.getCode());
|
|
||||||
} else {
|
|
||||||
sb.append(message);
|
|
||||||
}
|
}
|
||||||
|
sb.append(message);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -152,7 +156,11 @@ public class BaseWebSocketProcess {
|
|||||||
@Override
|
@Override
|
||||||
public void finish() {
|
public void finish() {
|
||||||
log.info("千问最后调用finish");
|
log.info("千问最后调用finish");
|
||||||
normalSendMsg(baseSession, sb.toString(), type);
|
String msg = sb.toString();
|
||||||
|
if(msg.replace(" ", "").length() > 0){
|
||||||
|
//纯空格的不推送
|
||||||
|
normalSendMsg(baseSession, sb.toString(), type);
|
||||||
|
}
|
||||||
MDC.remove(Log4Constans.PRINT_LOG_ID);
|
MDC.remove(Log4Constans.PRINT_LOG_ID);
|
||||||
}
|
}
|
||||||
}).flatMap(data ->{
|
}).flatMap(data ->{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user