fixed tournament blocking everything else

This commit is contained in:
Sakimori 2021-01-03 06:30:07 -05:00
parent d5f2ceeac9
commit 527170a81e

View File

@ -451,9 +451,7 @@ class StartTournamentCommand(Command):
tourney = leagues.tournament("Test Tourney", test_bracket, max_innings=3) tourney = leagues.tournament("Test Tourney", test_bracket, max_innings=3)
tourney.build_bracket(random_sort=True) tourney.build_bracket(random_sort=True)
tourney_task = asyncio.create_task(start_tournament_round(msg.channel, tourney)) await start_tournament_round(msg.channel, tourney)
await tourney_task
commands = [ commands = [
@ -759,21 +757,25 @@ async def start_tournament_round(channel, tourney, seeding = None):
ext = "?league=" + urllib.parse.quote_plus(tourney.name) ext = "?league=" + urllib.parse.quote_plus(tourney.name)
await channel.send(f"{len(current_games)} games started for the {tourney.name} tournament, at {config()['simmadome_url']+ext}") await channel.send(f"{len(current_games)} games started for the {tourney.name} tournament, at {config()['simmadome_url']+ext}")
tourney_task = asyncio.create_task(tourney_watcher(channel, tourney, current_games)) await tourney_watcher(channel, tourney, current_games))
await tourney_task
async def tourney_watcher(channel, tourney, games_list): async def tourney_watcher(channel, tourney, games_list):
tourney.active = True tourney.active = True
while len(games_list) > 0: while len(games_list) > 0:
for i in range(0, len(games_list)): try:
game, key = games_list[i] for i in range(0, len(games_list)):
if game.over and main_controller.master_games_dic[key][1]["end_delay"] <= 9: game, key = games_list[i]
final_embed = game_over_embed(game) if game.over and main_controller.master_games_dic[key][1]["end_delay"] <= 9:
await channel.send(f"A {tourney.name} game just ended!") final_embed = game_over_embed(game)
await channel.send(embed=final_embed) await channel.send(f"A {tourney.name} game just ended!")
gamesarray.pop(i) await channel.send(embed=final_embed)
break games_list.pop(i)
break
except:
print("something went wrong in tourney_watcher")
await asyncio.sleep(4)
tourney.active = False tourney.active = False
await channel.send(f"This round of games for {tourney.name} is now complete!") await channel.send(f"This round of games for {tourney.name} is now complete!")