@@ -14,6 +14,7 @@ import { VoteService } from './services/VoteService.js'
14
14
import { RoundsService } from './services/RoundsService.js'
15
15
import { fixRankCoherence } from './FixRankCoherence.js'
16
16
import 'dotenv/config'
17
+ import config from '../config/Config.js'
17
18
import './Trakman.js'
18
19
19
20
await Logger . initialize ( )
@@ -75,17 +76,17 @@ await Events.initialize()
75
76
Logger . trace ( 'Controller events enabled' )
76
77
Logger . info ( 'Controller started successfully' )
77
78
78
- process . on ( 'SIGINT' , async ( ) => {
79
+ process . on ( 'SIGINT' , ( ) => {
79
80
Logger . warn ( 'Controller terminated, exiting...' )
80
81
process . exit ( 0 )
81
82
} )
82
83
83
84
setInterval ( async ( ) => {
84
85
Logger . debug ( 'Checking if the dedicated server is alive...' )
85
- const status : { Code : number , Name : string } | Error = await Client . call ( 'GetStatus' )
86
+ const status = await Client . call ( 'GetStatus' )
86
87
if ( status instanceof Error ) {
87
88
// We don't need to wait to restart here since the timeout is 10s anyway - plenty of time for serv to start
88
- await Logger . fatal ( ' Healthcheck failed - no connection to the server. Game state was: ' , GameService . state )
89
+ await Logger . fatal ( ` Healthcheck failed - no connection to the server. Game state was: ${ GameService . state } ` )
89
90
}
90
91
Logger . debug ( 'Connection to the dedicated server exists.' )
91
- } , 10000 ) // make this configurable?
92
+ } , config . healthcheckInterval )
0 commit comments