MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / run

Method run

service/price.py:244–264  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

242 pyfalog.debug("Initialize PriceWorkerThread.")
243
244 def run(self):
245 queue = self.queue
246 while True:
247 if not self.running:
248 break
249 # Grab our data
250 callback, requests, fetchTimeout, validityOverride = queue.get()
251
252 # Grab prices, this is the time-consuming part
253 if len(requests) > 0:
254 Price.fetchPrices(requests, fetchTimeout, validityOverride)
255
256 wx.CallAfter(callback)
257 queue.task_done()
258
259 # After we fetch prices, go through the list of waiting items and call their callbacks
260 for price in requests:
261 callbacks = self.wait.pop(price.typeID, None)
262 if callbacks:
263 for callback in callbacks:
264 wx.CallAfter(callback)
265
266 def trigger(self, prices, callbacks, fetchTimeout, validityOverride):
267 self.queue.put((callbacks, prices, fetchTimeout, validityOverride))

Callers 1

dump_data.pyFile · 0.45

Calls 2

getMethod · 0.45
fetchPricesMethod · 0.45

Tested by

no test coverage detected