From 48adc137e59dfc795cc4dcb7a3c5bf93ccb736b1 Mon Sep 17 00:00:00 2001 From: Eduardo Wesley Date: Thu, 28 Jan 2021 01:11:09 -0300 Subject: [PATCH] fix: infinite loop in listeners index --- server/src/listeners/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/listeners/index.ts b/server/src/listeners/index.ts index 29385cf..f65e373 100644 --- a/server/src/listeners/index.ts +++ b/server/src/listeners/index.ts @@ -16,7 +16,7 @@ export default (io: Server, socket: Socket, gameManager: GameManager) => { } files.map(fileName => { - if(fileName !== 'index.ts') { + if(!/index.[j,t]s/.test(fileName)) { console.debug(`Initializing listener at: ${fileName}`); // Requires all the files in the directory that is not a index.js. const listener: (io: Server, socket: Socket, gameManager: GameManager) => void = require(resolve(__dirname, fileName)).default;