From b4769d23836ba6347f603c31a105306be6a1151a Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 14 Jul 2020 22:21:46 +0100 Subject: [PATCH] Use HSET instead of HINCR for population tracking --- houdini/handlers/play/navigation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/houdini/handlers/play/navigation.py b/houdini/handlers/play/navigation.py index 2385872..fe22687 100644 --- a/houdini/handlers/play/navigation.py +++ b/houdini/handlers/play/navigation.py @@ -119,7 +119,7 @@ async def handle_join_server(p, penguin_id: int, login_key: str): server_key = f'houdini.players.{p.server.config.id}' await p.server.redis.sadd(server_key, p.id) - await p.server.redis.hincrby('houdini.population', p.server.config.id, 1) + await p.server.redis.hset('houdini.population', p.server.config.id, len(p.server.penguins_by_id)) async def room_cooling(p): @@ -207,4 +207,4 @@ async def handle_disconnect_room(p): server_key = f'houdini.players.{p.server.config.id}' await p.server.redis.srem(server_key, p.id) - await p.server.redis.hincrby('houdini.population', p.server.config.id, -1) + await p.server.redis.hset('houdini.population', p.server.config.id, len(p.server.penguins_by_id))