perf: 优化消息已读
This commit is contained in:
19
resources/assets/js/store/actions.js
vendored
19
resources/assets/js/store/actions.js
vendored
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user