def update_charts(q, event, size):
try:
os.nice(10)
except AttributeError:
logging.warn("can't be nice to windows")
q.put((CRAWL_MESSAGE, 4, 'Chart engine starting...'))
base_map = graphics.create_map()
last_qso_timestamp = 0
q.put((CRAWL_MESSAGE, 4, ''))
try:
while not event.is_set():
t0 = time.time()
last_qso_timestamp = load_data(size, q, base_map, last_qso_timestamp)
t1 = time.time()
delta = t1 - t0
update_delay = config.DATA_DWELL_TIME - delta
if update_delay < 0:
update_delay = config.DATA_DWELL_TIME
logging.debug('Next data update in %f seconds', update_delay)
event.wait(update_delay)
except Exception, e:
logging.exception('Exception in update_charts', exc_info=e)
q.put((CRAWL_MESSAGE, 4, 'Chart engine failed.', graphics.YELLOW, graphics.RED))
评论列表
文章目录