mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 00:07:14 +03:00
Avoid spurious errors in debug log when polling
This commit is contained in:
parent
fdd770fe64
commit
daf53de57d
13
dashboard.py
13
dashboard.py
@ -118,12 +118,15 @@ class Dashboard(FileSystemEventHandler):
|
||||
def process(self, logfile=None):
|
||||
try:
|
||||
with open(join(self.currentdir, 'Status.json'), 'rb') as h:
|
||||
entry = json.load(h)
|
||||
data = h.read().strip()
|
||||
if data: # Can be empty if polling while the file is being re-written
|
||||
entry = json.loads(data)
|
||||
|
||||
# Status file is shared between beta and live. So filter out status not in this game session.
|
||||
if timegm(time.strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ')) >= self.session_start and self.status != entry:
|
||||
self.status = entry
|
||||
self.root.event_generate('<<DashboardEvent>>', when="tail")
|
||||
# Status file is shared between beta and live. So filter out status not in this game session.
|
||||
if (timegm(time.strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ')) >= self.session_start and
|
||||
self.status != entry):
|
||||
self.status = entry
|
||||
self.root.event_generate('<<DashboardEvent>>', when="tail")
|
||||
except:
|
||||
if __debug__: print_exc()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user