diff --git a/seraphsix/database.py b/seraphsix/database.py index cde60dc..d220deb 100644 --- a/seraphsix/database.py +++ b/seraphsix/database.py @@ -200,9 +200,12 @@ async def get_clan_members_inactive(self, clan_db, **kwargs): ).prefetch_related("member") async def create_game(self, game): - game_db = await Game.create(**vars(game)) - log.info(f"Game {game_db.instance_id} created") - return game_db + retval = None + game_db, is_created = await Game.get_or_create(**vars(game)) + if is_created: + log.info(f"Game {game.instance_id} created") + retval = game_db + return retval async def create_clan_game(self, game_db, game, clan_id): data = dict(clan_id=clan_id, game=game_db) diff --git a/seraphsix/tasks/activity.py b/seraphsix/tasks/activity.py index 1b841f6..a66c741 100644 --- a/seraphsix/tasks/activity.py +++ b/seraphsix/tasks/activity.py @@ -446,7 +446,7 @@ async def process_activity(ctx, activity, guild_id, guild_name, player_check=Fal game_db = await database.create_game(clan_game) if not game_db: - log.error(f"Continuing because error with storing game {game.instance_id}") + log.debug(f"Continuing because error with storing game {game.instance_id}") return await database.create_clan_game(game_db, clan_game, clan_game.clan_id)