- Restart after 10 minutes of inactivity from weather.im
This commit is contained in:
Christopher Cookman 2024-08-15 22:35:44 -06:00
parent 845fead37a
commit 662e0e775c
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -290,6 +290,8 @@ xmpp.on("offline", () => {
})
});
var restartTimer = null;
xmpp.on("stanza", (stanza) => {
// Debug stuff
if (config.debug >= 2) console.log(`${colors.magenta("[DEBUG]")} Stanza: ${stanza.toString()}`);
@ -315,6 +317,11 @@ xmpp.on("stanza", (stanza) => {
}
// Get new messages and log them, ignore old messages
if (stanza.is("message") && stanza.attrs.type === "groupchat") {
clearTimeout(restartTimer)
restartTimer = setTimeout(() => {
console.log(`${colors.red("[FATAL]")} No messages from weather.im in 10 minutes, restarting!!!!!!!!!!!`)
process.exit(1)
}, 600000)
// Stops spam from getting old messages
if (startup) return;
// Get channel name