From 2e25f27f1f3178722e3ac7b5b78546db043d26ef Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 9 Oct 2019 01:12:31 +0100 Subject: [PATCH] Reset redis population record at boot --- houdini/handlers/login/__init__.py | 2 +- houdini/handlers/play/navigation.py | 4 ++-- houdini/houdini.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/houdini/handlers/login/__init__.py b/houdini/handlers/login/__init__.py index 8184ad3..9e4440a 100644 --- a/houdini/handlers/login/__init__.py +++ b/houdini/handlers/login/__init__.py @@ -38,7 +38,7 @@ async def get_server_presence(p, pid): for server_name, server_config in config.servers.items(): if server_config['World']: - server_population = await p.server.redis.hget('population', server_config['Id']) + server_population = await p.server.redis.hget('houdini.population', server_config['Id']) server_population = (7 if int(server_population) == server_config['Capacity'] else int(server_population) // (server_config['Capacity'] // 6)) \ if server_population else 0 diff --git a/houdini/handlers/play/navigation.py b/houdini/handlers/play/navigation.py index 64297cf..a651fb7 100644 --- a/houdini/handlers/play/navigation.py +++ b/houdini/handlers/play/navigation.py @@ -59,7 +59,7 @@ async def handle_join_server(p, penguin_id: int, login_key: str): server_key = f'houdini.players.{p.server.server_config["Id"]}' await p.server.redis.sadd(server_key, p.data.id) - await p.server.redis.hincrby('population', p.server.server_config['Id'], 1) + await p.server.redis.hincrby('houdini.population', p.server.server_config['Id'], 1) @handlers.handler(XTPacket('j', 'jr')) @@ -92,4 +92,4 @@ async def handle_disconnect_room(p): server_key = f'houdini.players.{p.server.server_config["Id"]}' await p.server.redis.srem(server_key, p.data.id) - await p.server.redis.hincrby('population', p.server.server_config['Id'], -1) + await p.server.redis.hincrby('houdini.population', p.server.server_config['Id'], -1) diff --git a/houdini/houdini.py b/houdini/houdini.py index 518cd96..eb5b6db 100644 --- a/houdini/houdini.py +++ b/houdini/houdini.py @@ -159,7 +159,7 @@ class Houdini: if self.server_config['World']: await self.redis.delete(f'houdini.players.{self.server_config["Id"]}') - await self.redis.delete('{}.population'.format(self.server_name)) + await self.redis.hdel(f'houdini.population', self.server_config["Id"]) caches.set_config({ 'default': {