Queue updates within 30 second to avoid network spam

This commit is contained in:
HelloZeroNet 2016-03-30 23:15:18 +02:00
parent c8b949cef5
commit 0e13fbf5dc
2 changed files with 25 additions and 4 deletions

View file

@ -27,6 +27,12 @@ def isAllowed(event, allowed_again=10):
else:
return False
def delayLeft(event, allowed_again=10):
last_called = called_db.get(event)
if not last_called: # Its not called before
return 0
else:
return allowed_again - (time.time() - last_called)
def callQueue(event):
func, args, kwargs, thread = queue_db[event]