|
@@ -160,7 +160,7 @@ export class RoomAssistant {
|
|
|
|
|
|
async removeRoom(roomId) {
|
|
async removeRoom(roomId) {
|
|
this.room.logger.info("removeRoom", { roomId });
|
|
this.room.logger.info("removeRoom", { roomId });
|
|
- await this.redis.del(roomId);
|
|
|
|
|
|
+ await this.redis.del(getInKey(roomId));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -250,7 +250,7 @@ export class RoomAssistant {
|
|
this.room.logger.info("不是房主", JSON.stringify(user));
|
|
this.room.logger.info("不是房主", JSON.stringify(user));
|
|
await this.joinRoom(roomId, userId, user);
|
|
await this.joinRoom(roomId, userId, user);
|
|
} else {
|
|
} else {
|
|
- const hasRoom = await this.redis.hVals(roomId);
|
|
|
|
|
|
+ const hasRoom = await this.redis.hVals(getInKey(roomId));
|
|
if (hasRoom.length === 0) {
|
|
if (hasRoom.length === 0) {
|
|
this.room.logger.info("房主主动创建房间 :", { roomId, userId });
|
|
this.room.logger.info("房主主动创建房间 :", { roomId, userId });
|
|
await this.buildRoom(roomId, userId, user);
|
|
await this.buildRoom(roomId, userId, user);
|
|
@@ -339,18 +339,18 @@ export class RoomAssistant {
|
|
const userId = this.room.userId;
|
|
const userId = this.room.userId;
|
|
this.socket.leave(syncId);
|
|
this.socket.leave(syncId);
|
|
this.socket.leave(roomId);
|
|
this.socket.leave(roomId);
|
|
- await this.redis.del(syncId);
|
|
|
|
- await this.redis.del(userId);
|
|
|
|
|
|
+ await this.redis.del(getInKey(syncId));
|
|
|
|
+ await this.redis.del(getInKey(userId));
|
|
}
|
|
}
|
|
// RoomSessionId 房间有效时间
|
|
// RoomSessionId 房间有效时间
|
|
setRoomUnlimit(roomSessionId) {
|
|
setRoomUnlimit(roomSessionId) {
|
|
- return this.redis.expire(roomSessionId, -1);
|
|
|
|
|
|
+ return this.redis.expire(getInKey(roomSessionId), -1);
|
|
}
|
|
}
|
|
- setRoomAvailableBySeconds(roomSessionId, seconds) {
|
|
|
|
- return this.redis.expire(roomSessionId, seconds);
|
|
|
|
|
|
+ setRoomAvailableBySeconds(getInKey(roomSessionId), seconds) {
|
|
|
|
+ return this.redis.expire(getInKey(roomSessionId), seconds);
|
|
}
|
|
}
|
|
setRoomAvailableByHours(roomSessionId, hours) {
|
|
setRoomAvailableByHours(roomSessionId, hours) {
|
|
- return this.redis.expire(roomSessionId, 60 * 60 * hours);
|
|
|
|
|
|
+ return this.redis.expire(getInKey(roomSessionId), 60 * 60 * hours);
|
|
}
|
|
}
|
|
watchRoomExpired(callback) {
|
|
watchRoomExpired(callback) {
|
|
subClient.subscribe("__keyevent@0__:expired", this.watchRoomExpiredFn);
|
|
subClient.subscribe("__keyevent@0__:expired", this.watchRoomExpiredFn);
|