Skip to content

Commit

Permalink
Submission: Wait until game control information is configured
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Dreissig <f30@f30.me>
  • Loading branch information
rudis and F30 committed Apr 20, 2024
1 parent 8cbfed3 commit 31af95a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ctf_gameserver/submission/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 31af95a

Please sign in to comment.