refactor: use set

This commit is contained in:
Barış Soner Uşaklı
2026-03-02 16:58:43 -05:00
parent e3119c76f3
commit d9344140a0

View File

@@ -318,16 +318,16 @@ Sockets.getUidsInRoom = async function (room) {
return []; return [];
} }
const ioRoom = Sockets.server.in(room); const ioRoom = Sockets.server.in(room);
const uids = []; const uids = new Set();
if (ioRoom) { if (ioRoom) {
const sockets = await ioRoom.fetchSockets(); const sockets = await ioRoom.fetchSockets();
for (const s of sockets) { for (const s of sockets) {
if (s && s.data && s.data.uid > 0) { if (s && s.data && s.data.uid > 0) {
uids.push(s.data.uid); uids.add(s.data.uid);
} }
} }
} }
return _.uniq(uids); return [...uids];
}; };
Sockets.warnDeprecated = (socket, replacement) => { Sockets.warnDeprecated = (socket, replacement) => {