Attempt to introduce flood control. BROKEN.

This commit is contained in:
Storm Dragon 2024-03-13 18:27:46 -04:00
parent a8642a6440
commit 6644634d98

View File

@ -82,8 +82,15 @@ class eventManager():
return self._eventQueue return self._eventQueue
def getRunning(self): def getRunning(self):
return self.running return self.running
def getEventQueueSize(self):
return self._eventQueue.qsize()
def putToEventQueue(self,event, data): def putToEventQueue(self,event, data):
if not isinstance(event, fenrirEventType): if not isinstance(event, fenrirEventType):
return False return False
self._eventQueue.put({"Type":event,"Data":data}) if event == fenrirEventType.Ignore:
return True return False
if self.getEventQueueSize() > 40:
if not event in [fenrirEventType.ScreenUpdate, fenrirEventType.HeartBeat]:
self.cleanEventQueue()
self._eventQueue.put({"Type":event,"Data":data})
return True