Merge branch 'master' of github.com:thecodingmachine/workadventure into scaling
# Conflicts: # back/src/Services/SocketManager.ts # deeployer.libsonnet # docker-compose.yaml # front/src/Connexion/RoomConnection.ts # front/src/Enum/EnvironmentVariable.ts # front/src/Phaser/Game/GameScene.ts # front/webpack.config.js # pusher/src/Controller/IoSocketController.ts
This commit is contained in:
commit
6f2c319785
59 changed files with 7667 additions and 569 deletions
|
@ -6,8 +6,13 @@ class GaugeManager {
|
|||
private nbClientsPerRoomGauge: Gauge<string>;
|
||||
private nbGroupsPerRoomGauge: Gauge<string>;
|
||||
private nbGroupsPerRoomCounter: Counter<string>;
|
||||
private nbRoomsGauge: Gauge<string>;
|
||||
|
||||
constructor() {
|
||||
this.nbRoomsGauge = new Gauge({
|
||||
name: 'workadventure_nb_rooms',
|
||||
help: 'Number of active rooms'
|
||||
});
|
||||
this.nbClientsGauge = new Gauge({
|
||||
name: 'workadventure_nb_sockets',
|
||||
help: 'Number of connected sockets',
|
||||
|
@ -31,6 +36,13 @@ class GaugeManager {
|
|||
});
|
||||
}
|
||||
|
||||
incNbRoomGauge(): void {
|
||||
this.nbRoomsGauge.inc();
|
||||
}
|
||||
decNbRoomGauge(): void {
|
||||
this.nbRoomsGauge.dec();
|
||||
}
|
||||
|
||||
incNbClientPerRoomGauge(roomId: string): void {
|
||||
this.nbClientsGauge.inc();
|
||||
this.nbClientsPerRoomGauge.inc({ room: roomId });
|
||||
|
|
|
@ -320,6 +320,7 @@ export class SocketManager {
|
|||
room.leave(user);
|
||||
if (room.isEmpty()) {
|
||||
this.rooms.delete(room.roomId);
|
||||
gaugeManager.decNbRoomGauge();
|
||||
debug('Room is empty. Deleting room "%s"', room.roomId);
|
||||
}
|
||||
} finally {
|
||||
|
@ -349,6 +350,7 @@ export class SocketManager {
|
|||
world.tags = data.tags
|
||||
world.policyType = Number(data.policy_type)
|
||||
}
|
||||
gaugeManager.incNbRoomGauge();
|
||||
this.rooms.set(roomId, world);
|
||||
}
|
||||
return Promise.resolve(world)
|
||||
|
@ -718,6 +720,7 @@ export class SocketManager {
|
|||
room.adminLeave(admin);
|
||||
if (room.isEmpty()) {
|
||||
this.rooms.delete(room.roomId);
|
||||
gaugeManager.decNbRoomGauge();
|
||||
debug('Room is empty. Deleting room "%s"', room.roomId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue