1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 16:27:13 +03:00

Log server lagging

This commit is contained in:
Jonathan Harris 2017-08-21 18:50:32 +01:00
parent 8e233fdeaf
commit e314f64464
2 changed files with 5 additions and 4 deletions

View File

@ -448,7 +448,7 @@ class AppWindow:
raise companion.CmdrError() # Companion API return doesn't match Journal
elif ((auto_update and not data['commander'].get('docked')) or
(data['lastSystem']['name'] != monitor.system) or
((monitor.station or data['commander']['docked']) and data['lastStarport']['name'] != monitor.station) or
((data['commander']['docked'] and data['lastStarport']['name'] or None) != monitor.station) or
(data['ship']['id'] != monitor.state['ShipID']) or
(data['ship']['name'].lower() != monitor.state['ShipType'])):
raise companion.ServerLagging()
@ -483,7 +483,7 @@ class AppWindow:
pass
elif not data['commander'].get('docked'):
if not event and not retrying:
if auto_update and not retrying:
# Silently retry if we got here by 'Automatically update on docking' and the server hasn't caught up
self.w.after(int(SERVER_RETRY * 1000), lambda:self.getandsend(event, True))
return # early exit to avoid starting cooldown count
@ -536,6 +536,7 @@ class AppWindow:
# Companion API problem
except (companion.ServerError, companion.ServerLagging) as e:
if retrying:
print 'Lagging: %s,%s != %s,%s' % (data['lastSystem']['name'], data['commander']['docked'] and data['lastStarport']['name'] or 'undocked', monitor.system, monitor.station)
self.status['text'] = unicode(e)
play_bad = True
else:

View File

@ -392,8 +392,8 @@ class EDLogs(FileSystemEventHandler):
self.coordinates = tuple(entry['StarPos'])
elif self.system != entry['StarSystem']:
self.coordinates = None # Docked event doesn't include coordinates
self.system = entry['StarSystem'] == 'ProvingGround' and 'CQC' or entry['StarSystem']
self.station = entry.get('StationName') # May be None
(self.system, self.station) = (entry['StarSystem'] == 'ProvingGround' and 'CQC' or entry['StarSystem'],
entry.get('StationName')) # May be None
self.stationtype = entry.get('StationType') # May be None
elif entry['event'] == 'SupercruiseExit':
self.planet = entry.get('Body') if entry.get('BodyType') == 'Planet' else None