From ee6fe5419d2cb87301236023ddf10ea2f0503c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Tue, 1 May 2018 14:16:21 +0200 Subject: Handle update check in case of server timeouts --- main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 1fef7cc..187ceec 100755 --- a/main.py +++ b/main.py @@ -188,15 +188,17 @@ def server(): for _, serverdata in servers.items(): name = "{0}{1:d}{2:d}".format(serverdata['ip'], serverdata['port'], serverdata['gameid']) serverdata['data'] = serverdata_[name].result() - serverdata_['u' + name] = executor.submit( - steam.getGameUpdateState, - serverdata['data']['gameid'], - serverdata['data']['gameversion'] - ) + if serverdata['data']: + serverdata_['u' + name] = executor.submit( + steam.getGameUpdateState, + serverdata['data']['gameid'], + serverdata['data']['gameversion'], + ) for _, serverdata in servers.items(): name = "{0}{1:d}{2:d}".format(serverdata['ip'], serverdata['port'], serverdata['gameid']) - serverdata['update'] = serverdata_['u' + name].result() + if 'u' + name in serverdata_: + serverdata['update'] = serverdata_['u' + name].result() return render_template('server_html.jinja', servers=servers, -- cgit v1.2.3