perf: dont send doc view updates to self
This commit is contained in:
parent
c3a37421d6
commit
4ea6f3d672
1 changed files with 3 additions and 1 deletions
|
|
@ -271,7 +271,6 @@ function send_users(args) {
|
||||||
if (!(args && args.doctype && args.docname)) {
|
if (!(args && args.doctype && args.docname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const open_doc_room = get_open_doc_room(args.socket, args.doctype, args.docname);
|
const open_doc_room = get_open_doc_room(args.socket, args.doctype, args.docname);
|
||||||
|
|
||||||
const clients = Array.from(io.sockets.adapter.rooms.get(open_doc_room) || []);
|
const clients = Array.from(io.sockets.adapter.rooms.get(open_doc_room) || []);
|
||||||
|
|
@ -283,6 +282,9 @@ function send_users(args) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// dont send update to self. meaningless.
|
||||||
|
if (users.length == 1 && users[0] == args.socket.user) return;
|
||||||
|
|
||||||
// notify
|
// notify
|
||||||
io.to(open_doc_room).emit("doc_viewers", {
|
io.to(open_doc_room).emit("doc_viewers", {
|
||||||
doctype: args.doctype,
|
doctype: args.doctype,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue