Browse Source

Maybe it will come back with this? Mabye?!

Douglas William Thrift 13 years ago
parent
commit
c433f6d499
1 changed files with 9 additions and 0 deletions
  1. 9 0
      locationbot.py

+ 9 - 0
locationbot.py

@@ -828,7 +828,16 @@ class LocationBot(ircbot.SingleServerIRCBot):
 				else:
 					self.connection.part(channel)
 
+		ping_next = datetime.utcnow() + timedelta(minutes = 1)
+
 		while not self.__reloading:
+			now = datetime.utcnow()
+
+			if now >= ping_next:
+				self.connection.ping(self.connection.server)
+
+				ping_next = now + timedelta(minutes = 1)
+
 			if self.__locations_lock.acquire(False):
 				if self.__locations and self.__channels.issubset(self.channels.keys()):
 					for nick, channel, granularity, location, coordinates, accuracy, speed, heading, altitude, altitude_accuracy in self.__locations: