Skip to content

Commit

Permalink
Fix: Ensure that LadderService continues to process matches (#449)
Browse files Browse the repository at this point in the history
* Ensure that LadderService continues to process matches if it encounters an error

* Add searches to the logging statement

This info is probably redundant because there should be matchmakerqueue 
logging right before it, but who the heck knows. Better to be safe than 
sorry I guess.
  • Loading branch information
Askaholic authored and Rackover committed Jun 11, 2019
1 parent 34de3bc commit 244eb09
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions server/ladder_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,22 @@ def inform_player(self, player: Player):

async def handle_queue_matches(self):
async for s1, s2 in self.queues["ladder1v1"].iter_matches():
assert len(s1.players) == 1
assert len(s2.players) == 1
p1, p2 = s1.players[0], s2.players[0]
msg = {
"command": "match_found",
"queue": "ladder1v1"
}
p1.lobby_connection.send(msg)
p2.lobby_connection.send(msg)
asyncio.ensure_future(self.start_game(p1, p2))
try:
assert len(s1.players) == 1
assert len(s2.players) == 1
p1, p2 = s1.players[0], s2.players[0]
msg = {
"command": "match_found",
"queue": "ladder1v1"
}
p1.lobby_connection.send(msg)
p2.lobby_connection.send(msg)
asyncio.ensure_future(self.start_game(p1, p2))
except Exception as e:
self._logger.exception(
"Error processing match between searches %s, and %s: %s",
s1, s2, e
)

async def start_game(self, host: Player, guest: Player):
self._logger.debug("Starting ladder game between %s and %s", host, guest)
Expand Down

0 comments on commit 244eb09

Please sign in to comment.