Reduce ping interval from 30 seconds to 10 seconds and update log output format

This commit is contained in:
2026-03-09 08:22:57 +01:00
parent 3f71f8b655
commit 7e84cd3f27

View File

@@ -13,11 +13,10 @@ class Uptime {
console.log('Starting...');
console.log(`Starting at ${this.startTime.toLocaleDateString()} ${this.startTime.toLocaleTimeString()}`);
this.handle();
setInterval(() => this.handle(), 1000 * 30);
setInterval(() => this.handle(), 1000 * 10);
}
async handle() {
console.log('Fetch status...')
await ping.sys.probe('node.under-scape.com', (isAlive) => {
const now = new Date();
this.totalIte++;
@@ -35,7 +34,7 @@ class Uptime {
});
}
console.log(`[${now.toLocaleDateString()} ${now.toLocaleTimeString()}] Total: ${this.totalIte} Up: ${this.totalUp} Down: ${this.totalDown} Uptime: ${Math.round((this.totalUp / this.totalIte) * 100)}%`)
process.stdout.write(`[${now.toLocaleDateString()} ${now.toLocaleTimeString()}] Total: ${this.totalIte} Up: ${this.totalUp} Down: ${this.totalDown} Uptime: ${Math.round((this.totalUp / this.totalIte) * 100)}%\r`)
}, {timeout: 10});
}
}