Skip to content

Redis client not found when created background tasks in Swagger #151

@scottyeung

Description

@scottyeung

Describe the bug or question
A clear and concise description of what the bug or question is.

To Reproduce
Please provide a self-contained, minimal, and reproducible example of your use case

async def is_rate_limited(db: AsyncSession, user_id: int, path: str, limit: int, period: int) -> bool:
    if client is None:
        logger.error("Redis client is not initialized.")
        raise Exception("Redis client is not initialized.")

Description
Redis client was recognised as none when I tried to create background tasks in Swagger and caught exception in is_rate_limited

Screenshots
Screenshot 2024-09-08 at 5 12 24 PM
Screenshot 2024-09-08 at 5 12 36 PM
Screenshot 2024-09-08 at 5 14 44 PM

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions