Jelajahi Sumber

Fix crash on closing (3)

Markus-Rost 4 tahun lalu
induk
melakukan
aab71ae862
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      main.js

+ 2 - 1
main.js

@@ -1,6 +1,6 @@
 require('dotenv').config();
 require('dotenv').config();
 
 
-const isDebug = ( process.argv[2] === 'debug' );
+var isDebug = ( process.argv[2] === 'debug' );
 if ( process.argv[2] === 'readonly' ) process.env.READONLY = true;
 if ( process.argv[2] === 'readonly' ) process.env.READONLY = true;
 
 
 require('./database.js').then( () => {
 require('./database.js').then( () => {
@@ -331,6 +331,7 @@ if ( isDebug && process.argv[3]?.startsWith( '--timeout:' ) ) {
 	console.log( `\n- Close process in ${timeout} seconds!\n` );
 	console.log( `\n- Close process in ${timeout} seconds!\n` );
 	setTimeout( () => {
 	setTimeout( () => {
 		console.log( `\n- Running for ${timeout} seconds, closing process!\n` );
 		console.log( `\n- Running for ${timeout} seconds, closing process!\n` );
+		isDebug = false;
 		manager.shards.filter( shard => shard.process && !shard.process.killed ).forEach( shard => shard.kill() );
 		manager.shards.filter( shard => shard.process && !shard.process.killed ).forEach( shard => shard.kill() );
 		if ( typeof server !== 'undefined' && !server.killed ) server.kill();
 		if ( typeof server !== 'undefined' && !server.killed ) server.kill();
 	}, timeout * 1000 ).unref();
 	}, timeout * 1000 ).unref();