INNER CODE UNIT · Python

create_redis_pool

Kludex/fastapi-microservices · users/app/main.py:10

async def create_redis_pool():
    redis.pool = await create_pool(
        RedisSettings(host=settings.REDIS_HOST, port=settings.REDIS_PORT)
    )


async def close_redis_pool():
    redis.pool.close()


def create_application() -> FastAPI:
    application = FastAPI(title=settings.PROJECT_NAME)
    application.include_router(router)
    application.add_event_handler("startup", create_redis_pool)
    application.add_event_handler("shutdown", close_redis_pool)
    return application

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…