diff --git a/bot/legends/track.py b/bot/legends/track.py index f102964..dd556da 100644 --- a/bot/legends/track.py +++ b/bot/legends/track.py @@ -152,7 +152,7 @@ async def main(): "new_data" : player.to_dict(), "timestamp": int(pend.now(tz=pend.UTC).timestamp())} if player.clan is not None and player.clan.tag in clan_tags: - producer.send(topic="player", value=orjson.dumps(json_data), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp()) * 1000) + producer.send(topic="player", value=orjson.dumps(json_data), key=player.clan.tag.encode("utf-8"), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp()) * 1000) diff_trophies = player.trophies - previous_player.trophies diff_attacks = player.attackWins - previous_player.attackWins diff --git a/bot/player/track.py b/bot/player/track.py index 8f04944..027f3d2 100644 --- a/bot/player/track.py +++ b/bot/player/track.py @@ -250,7 +250,7 @@ def recursive_defaultdict(): if type_changes and (clan_tag in clan_tags): json_data = {"types": type_changes, "old_player": previous_response, "new_player": response, "timestamp": int(pend.now(tz=pend.UTC).timestamp())} - producer.send(topic="player", value=orjson.dumps(json_data), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp()) * 1000) + producer.send(topic="player", value=orjson.dumps(json_data), key=clan_tag.encode("utf-8"), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp()) * 1000) def to_regular_dict(d): """Recursively converts a defaultdict to a regular dict."""