Skip to content

Commit d56d86c

Browse files
committed
fix(Matchmake): fix entities io (#58)
1 parent afcf57b commit d56d86c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/ttt/application/user/game/matchmake.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from asyncio import gather
2+
from contextlib import suppress
23
from dataclasses import dataclass
34

45
from ttt.application.common.ports.emojis import Emojis
@@ -43,11 +44,13 @@ async def _result(self, tracking: Tracking) -> list[Game]:
4344
games = list[Game]()
4445
matchmaking_ = matchmaking(users, input_, tracking)
4546

46-
try:
47+
with suppress(StopIteration):
48+
games.append(next(matchmaking_))
49+
4750
while True:
4851
games.append(matchmaking_.send(await self._matchmaking_input()))
49-
except StopIteration:
50-
return games
52+
53+
return games
5154

5255
async def _matchmaking_input(self) -> MatchmakingInput:
5356
(

src/ttt/entities/core/user/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ def dont_wait_for_matchmaking(self, tracking: Tracking) -> None:
463463
else_=UserIsNotWaitingForMatchmakingError,
464464
)
465465

466-
tracking.register_unused(self.matchmaking_waiting)
467466
self.matchmaking_waiting = None
467+
tracking.register_mutated(self)
468468

469469

470470
UserAtomic = User | UserEmoji

0 commit comments

Comments
 (0)