Skip to content

Commit

Permalink
add: key to producer send
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Apr 11, 2024
1 parent 398dde8 commit 1a115ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bot/legends/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bot/player/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 1a115ed

Please sign in to comment.