Adjust the log stack for the cleanup
This commit is contained in:
parent
d4d01bf3ac
commit
d49b214762
1 changed files with 6 additions and 4 deletions
10
src/main.ts
10
src/main.ts
|
|
@ -35,13 +35,15 @@ const db_dir = `data`;
|
||||||
* whatever reason. It cleans up and writes all the active games to the disk.
|
* whatever reason. It cleans up and writes all the active games to the disk.
|
||||||
*/
|
*/
|
||||||
function clean_up() {
|
function clean_up() {
|
||||||
|
log.info(`Cleaning up games...`);
|
||||||
for (var code in active_games) {
|
for (var code in active_games) {
|
||||||
console.log(`Writing game: ${code} to disk`);
|
log.debug(`Writing game: ${code} to disk`);
|
||||||
writeFileSync(`${db_dir}/${code}`, active_games[code].toJSON());
|
log.silly(active_games[code]);
|
||||||
|
// writeFileSync(`${db_dir}/${code}`, active_games[code].toJSON());
|
||||||
};
|
};
|
||||||
log.info(`Finished saving games to disk.`);
|
log.info(`Finished cleanup. Exiting.`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Listen to the signals for the cleanup requirement
|
// Listen to the signals for the cleanup requirement
|
||||||
process.on(`uncaughtException`, clean_up);
|
process.on(`uncaughtException`, clean_up);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue