Skip to content

time.sleep() in async endpoint '/delay' endpoints blocks the event loop.Also in '/delay/ endpoint there is incorrect error handling io.py file #87

@aditya047-stack

Description

@aditya047-stack

Bug:

-1.The time.sleep() removes the special ability of running program code asynchronously.
-2.The error handling is weak in '/delay' endpoint because when '400' error is raised it doesn't get handled and get converted into '500' error.

Fix:

-1.-Add 'import asyncio' in program.
-Add asyncio.sleep() in place of 'time.sleep()'.
-This retain the power of async in program.

-2.-Add the 'HTTPException' in '/delay' endpoint code block to handle the '400'error.

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