more handler

This commit is contained in:
HolographicHat
2022-03-30 14:09:50 +08:00
parent 0ab6444b6f
commit a23d7f3cc9
2 changed files with 8 additions and 3 deletions

7
app.js
View File

@@ -12,7 +12,6 @@ const onExit = () => {
cp.execSync("pause > nul", { stdio: "inherit" })
};
// TODO: use kotlin rewrite it
(async () => {
try {
process.once("SIGHUP", () => {
@@ -77,11 +76,13 @@ const onExit = () => {
}
}
let monitor;
let stopped = false
const createMonitor = () => {
monitor = setInterval(async () => {
if (login && lastRecvTimestamp + 2 < parseInt(Date.now() / 1000)) {
if (login && lastRecvTimestamp + 2 < parseInt(Date.now() / 1000) && !stopped) {
stopped = true
unexpectedExit = false
server.close()
server.close(() => {})
hServer.close()
gameProcess.kill()
clearInterval(monitor)

View File

@@ -124,6 +124,10 @@ const exportData = async proto => {
case "2":
await exportToSeelie(proto)
break
case "raw":
fs.writeFileSync(`./export-${Date.now()}-raw.json`, JSON.stringify(proto,null,2))
console.log("OK")
break
default:
await exportToCsv(proto)
}