Adding finally clause to make sure Prometheus indicators are ok
This commit is contained in:
parent
31846d1640
commit
6412c56fcd
@ -295,6 +295,7 @@ export class IoSocketController {
|
|||||||
leaveRoom(Client : ExSocketInterface){
|
leaveRoom(Client : ExSocketInterface){
|
||||||
// leave previous room and world
|
// leave previous room and world
|
||||||
if(Client.roomId){
|
if(Client.roomId){
|
||||||
|
try {
|
||||||
Client.to(Client.roomId).emit(SockerIoEvent.USER_LEFT, Client.userId);
|
Client.to(Client.roomId).emit(SockerIoEvent.USER_LEFT, Client.userId);
|
||||||
|
|
||||||
//user leave previous world
|
//user leave previous world
|
||||||
@ -307,10 +308,12 @@ export class IoSocketController {
|
|||||||
}
|
}
|
||||||
//user leave previous room
|
//user leave previous room
|
||||||
Client.leave(Client.roomId);
|
Client.leave(Client.roomId);
|
||||||
|
} finally {
|
||||||
this.nbClientsPerRoomGauge.dec({ host: os.hostname(), room: Client.roomId });
|
this.nbClientsPerRoomGauge.dec({ host: os.hostname(), room: Client.roomId });
|
||||||
delete Client.roomId;
|
delete Client.roomId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private joinRoom(Client : ExSocketInterface, roomId: string, position: PointInterface): World {
|
private joinRoom(Client : ExSocketInterface, roomId: string, position: PointInterface): World {
|
||||||
//join user in room
|
//join user in room
|
||||||
|
Loading…
Reference in New Issue
Block a user