- Restart after 10 minutes of inactivity from weather.im
This commit is contained in:
		
							parent
							
								
									845fead37a
								
							
						
					
					
						commit
						662e0e775c
					
				
							
								
								
									
										7
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								index.js
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue