From 31af95aef60da8f2c69323f9d05d0dc846965d83 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 20 Apr 2024 16:16:08 +0200 Subject: [PATCH] Submission: Wait until game control information is configured Co-authored-by: Felix Dreissig --- src/ctf_gameserver/submission/submission.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ctf_gameserver/submission/submission.py b/src/ctf_gameserver/submission/submission.py index 06fdd68..fa3e90e 100644 --- a/src/ctf_gameserver/submission/submission.py +++ b/src/ctf_gameserver/submission/submission.py @@ -106,14 +106,17 @@ def main(): metrics = make_metrics() metrics['start_timestamp'].set_to_current_time() - try: - competition_name, flag_prefix = database.get_static_info(db_conn) - except DBDataError as e: - logging.error('Invalid database state, exiting: %s', e) - return os.EX_DATAERR - daemon.notify('READY=1') + while True: + try: + competition_name, flag_prefix = database.get_static_info(db_conn) + except DBDataError as e: + logging.warning('Invalid database state, sleeping for 60 seconds: %s', e) + time.sleep(60) + else: + break + asyncio.run(serve(listen_host, listen_port, db_conn, { 'flag_secret': flag_secret, 'team_regex': team_regex,