mirror of
https://github.com/solero/houdini.git
synced 2024-11-25 23:17:24 +00:00
Reset redis population record at boot
This commit is contained in:
parent
82be5e3021
commit
2e25f27f1f
@ -38,7 +38,7 @@ async def get_server_presence(p, pid):
|
|||||||
|
|
||||||
for server_name, server_config in config.servers.items():
|
for server_name, server_config in config.servers.items():
|
||||||
if server_config['World']:
|
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']
|
server_population = (7 if int(server_population) == server_config['Capacity']
|
||||||
else int(server_population) // (server_config['Capacity'] // 6)) \
|
else int(server_population) // (server_config['Capacity'] // 6)) \
|
||||||
if server_population else 0
|
if server_population else 0
|
||||||
|
@ -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"]}'
|
server_key = f'houdini.players.{p.server.server_config["Id"]}'
|
||||||
await p.server.redis.sadd(server_key, p.data.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'))
|
@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"]}'
|
server_key = f'houdini.players.{p.server.server_config["Id"]}'
|
||||||
await p.server.redis.srem(server_key, p.data.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)
|
||||||
|
@ -159,7 +159,7 @@ class Houdini:
|
|||||||
|
|
||||||
if self.server_config['World']:
|
if self.server_config['World']:
|
||||||
await self.redis.delete(f'houdini.players.{self.server_config["Id"]}')
|
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({
|
caches.set_config({
|
||||||
'default': {
|
'default': {
|
||||||
|
Loading…
Reference in New Issue
Block a user