introduce back delay
This commit is contained in:
parent
ec48007377
commit
13ab981c59
@ -810,20 +810,24 @@ import pickle
|
|||||||
def save_games():
|
def save_games():
|
||||||
global save_lock
|
global save_lock
|
||||||
if not save_lock:
|
if not save_lock:
|
||||||
|
sio.sleep(2)
|
||||||
with open('games.pickle', 'wb') as f:
|
with open('games.pickle', 'wb') as f:
|
||||||
pickle.dump([g for g in games if g.started], f)
|
pickle.dump([g for g in games if g.started], f)
|
||||||
save_games()
|
save_games()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if os.path.exists('games.pickle'):
|
if os.path.exists('games.pickle'):
|
||||||
with open('games.pickle', 'rb') as file:
|
try:
|
||||||
games = pickle.load(file)
|
with open('games.pickle', 'rb') as file:
|
||||||
for g in games:
|
games = pickle.load(file)
|
||||||
for p in g.players:
|
for g in games:
|
||||||
if p.sid != 'bot':
|
for p in g.players:
|
||||||
sio.start_background_task(p.disconnect)
|
if p.sid != 'bot':
|
||||||
else:
|
sio.start_background_task(p.disconnect)
|
||||||
sio.start_background_task(p.bot_spin)
|
else:
|
||||||
|
sio.start_background_task(p.bot_spin)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
sio.start_background_task(save_games)
|
sio.start_background_task(save_games)
|
||||||
sio.start_background_task(pool_metrics)
|
sio.start_background_task(pool_metrics)
|
||||||
eventlet.wsgi.server(eventlet.listen(('', 5001)), CustomProxyFix(app))
|
eventlet.wsgi.server(eventlet.listen(('', 5001)), CustomProxyFix(app))
|
||||||
|
Loading…
Reference in New Issue
Block a user