perf: 优化消息已读

This commit is contained in:
kuaifan
2022-09-18 21:20:24 +08:00
parent 2693cf17ea
commit 4bef2f5287
2 changed files with 36 additions and 13 deletions

View File

@@ -2373,20 +2373,13 @@ export default {
const id = $A.cloneJSON(state.wsReadWaitList);
state.wsReadWaitList = [];
//
dispatch("websocketSend", {
type: 'readMsg',
data: {id}
dispatch("call", {
url: 'dialog/msg/read',
data: {
id: id.join(",")
}
}).catch(_ => {
// try again later
setTimeout(_ => {
dispatch("websocketSend", {
type: 'readMsg',
data: {id}
}).catch(_ => {
// or fail
state.wsReadWaitList.push(...id)
});
}, 1000)
state.wsReadWaitList.push(...id)
});
}, 50);
},