Run a check of all active games for ones with no socket connections.
This commit is contained in:
parent
aee33fd63a
commit
c34fec10ad
1 changed files with 4 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import { games, log } from '../main';
|
||||||
import { Game } from '../objects/Game';
|
import { Game } from '../objects/Game';
|
||||||
import { Player } from '../objects/Player';
|
import { Player } from '../objects/Player';
|
||||||
import { Server, Socket } from 'socket.io';
|
import { Server, Socket } from 'socket.io';
|
||||||
|
import { routineCheck } from '../utils/cleanup';
|
||||||
|
|
||||||
export default (io: Server, socket: Socket, data: CreateGame) => {
|
export default (io: Server, socket: Socket, data: CreateGame) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -22,6 +23,9 @@ export default (io: Server, socket: Socket, data: CreateGame) => {
|
||||||
game_code: game.id,
|
game_code: game.id,
|
||||||
players: game.playerData,
|
players: game.playerData,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Check for any inactive games that are still marked as active
|
||||||
|
routineCheck();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
socket.emit(`GameCreated`, {
|
socket.emit(`GameCreated`, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue