This commit is contained in:
2025-05-21 10:57:51 +08:00
parent 2fadeeaa77
commit 6dbcd6fba0
2 changed files with 3 additions and 4 deletions

View File

@@ -69,7 +69,7 @@ async def main():
flush_files()
redis.init(conf.get("redis", None))
await redis.init(conf.get("redis", None))
redis.on_room_changed = on_room_changed
TEST_ROOM_IDS = list(set(TEST_ROOM_IDS + redis.get_room_list()))

View File

@@ -9,7 +9,7 @@ r: redis.Redis | None = None
on_room_changed: Callable[[list[int]], Awaitable[None]] | None = None
def init(redis_conf: dict | None):
async def init(redis_conf: dict | None) -> None:
global r
if redis_conf is None:
@@ -21,8 +21,7 @@ def init(redis_conf: dict | None):
db=redis_conf.get("port", 0),
)
# run subscribe_redis on new thread
threading.Thread(target=_subscribe_redis, daemon=True).start()
asyncio.create_task(_subscribe_redis_async())
def get_room_list() -> list[int]: