diff --git a/tipbot/command_manager.py b/tipbot/command_manager.py index 0bf555b..12ac726 100644 --- a/tipbot/command_manager.py +++ b/tipbot/command_manager.py @@ -9,6 +9,7 @@ # any later version. # +import time import tipbot.config as config from tipbot.utils import * @@ -23,7 +24,7 @@ def SendToProxy(link,msg): def RunRegisteredCommand(link,ifyes,yesdata,ifno,nodata): if link.identity() not in calltable: calltable[link.identity()] = [] - calltable[link.identity()].append([link,ifyes,yesdata,ifno,nodata]) + calltable[link.identity()].append([link,ifyes,yesdata,ifno,nodata,time.time()+10]) if link.network.is_identified(link): RunNextCommand(link,True) else: @@ -58,6 +59,16 @@ def RunNextCommand(link,registered): finally: Unlock() +def PruneOldWaitingCommands(): + Lock() + now=time.time() + for identity in calltable.keys(): + while len(calltable[identity])>0 and calltable[identity][0][5]