Skip to content

Commit e80c68b

Browse files
committed
✨Stop working with matches that are terminated in lobby
1 parent 86429f6 commit e80c68b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/modules/public/dota_rp_flow/component.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -780,17 +780,20 @@ async def conclude_friend_match(self, friend: Friend) -> None:
780780
(match := friend.active_match)
781781
and isinstance(match, PlayingMatch)
782782
and match.match_id
783-
and match.live == LiveIndicator.Live
784783
):
785-
match.live = LiveIndicator.Pending
786-
query = """
787-
UPDATE ttv_dota_matches
788-
SET live = $1
789-
WHERE match_id = $2;
790-
"""
791-
await self.bot.pool.execute(query, LiveIndicator.Pending, match.match_id)
792-
if not self.process_pending_matches.is_running():
793-
self.process_pending_matches.start()
784+
if match.live == LiveIndicator.Live:
785+
match.live = LiveIndicator.Pending
786+
query = """
787+
UPDATE ttv_dota_matches
788+
SET live = $1
789+
WHERE match_id = $2;
790+
"""
791+
await self.bot.pool.execute(query, LiveIndicator.Pending, match.match_id)
792+
if not self.process_pending_matches.is_running():
793+
self.process_pending_matches.start()
794+
elif match.live == LiveIndicator.Starting:
795+
# It means that the lobby terminated before heroes were picked;
796+
match.update_data.cancel()
794797

795798
friend.active_match = None
796799

0 commit comments

Comments
 (0)