Get rid of caching code in shipbrowser and do it in the service instead

(faster, less code, cleaner)
This commit is contained in:
cncfanatics
2010-11-03 09:51:25 +01:00
parent 8aec0e82fb
commit eef0d9d1b1
2 changed files with 22 additions and 39 deletions

View File

@@ -29,15 +29,21 @@ import traceback
class ShipBrowserWorkerThread(threading.Thread):
def run(self):
self.queue = Queue.Queue()
self.cache = {}
self.processRequests()
def processRequests(self):
queue = self.queue
cache = self.cache
sMarket = Market.getInstance()
while True:
try:
callback, id = queue.get()
list = sMarket.getShipList(id)
list = cache.get(id)
if list is None:
list = sMarket.getShipList(id)
cache[id] = list
wx.CallAfter(callback, (id,list))
except:
pass