잦은 redis call 회피

This commit is contained in:
2023-07-18 11:04:15 +09:00
parent 289af24a8f
commit 82abcddb49

View File

@ -339,7 +339,7 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
room = makeRoom(name, roomDestroyChan) room = makeRoom(name, roomDestroyChan)
rooms[name] = room rooms[name] = room
room.start(ctx) room.start(ctx)
go sh.callReceiver.OnRoomCreated(sh.region, name) sh.callReceiver.OnRoomCreated(sh.region, name)
} }
return room return room
} }
@ -352,7 +352,7 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
select { select {
case destroyedRoom := <-roomDestroyChan: case destroyedRoom := <-roomDestroyChan:
delete(rooms, destroyedRoom) delete(rooms, destroyedRoom)
go sh.callReceiver.OnRoomDestroyed(sh.region, destroyedRoom) sh.callReceiver.OnRoomDestroyed(sh.region, destroyedRoom)
case usermsg := <-sh.localDeliveryChan: case usermsg := <-sh.localDeliveryChan:
// 로컬에 connection이 있는지 먼저 확인해 보기 위한 채널 // 로컬에 connection이 있는지 먼저 확인해 보기 위한 채널
@ -475,10 +475,10 @@ func (sh *subhandler) mainLoop(ctx context.Context) {
room.out(c) room.out(c)
} }
c.joinedRooms = nil c.joinedRooms = nil
go sh.callReceiver.OnClientMessageReceived(c.sender, Disconnected, nil) sh.callReceiver.OnClientMessageReceived(c.sender, Disconnected, nil)
} else { } else {
entireConns[c.sender.Accid.Hex()] = c entireConns[c.sender.Accid.Hex()] = c
go sh.callReceiver.OnClientMessageReceived(c.sender, Connected, nil) sh.callReceiver.OnClientMessageReceived(c.sender, Connected, nil)
} }
} }
} }