mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Make the room exists when autopruning.
This commit is contained in:
4
index.js
4
index.js
@@ -64,7 +64,7 @@ Adapter.prototype.del = function(id, room, fn){
|
||||
this.rooms[room] = this.rooms[room] || {};
|
||||
delete this.sids[id][room];
|
||||
delete this.rooms[room][id];
|
||||
if (!keys(this.rooms[room]).length) {
|
||||
if (this.rooms.hasOwnProperty(room) && !keys(this.rooms[room]).length) {
|
||||
delete this.rooms[room];
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ Adapter.prototype.delAll = function(id, fn){
|
||||
delete this.rooms[room][id];
|
||||
}
|
||||
|
||||
if (!keys(this.rooms[room]).length) {
|
||||
if (this.rooms.hasOwnProperty(room) && !keys(this.rooms[room]).length) {
|
||||
delete this.rooms[room];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user