Skip to content

AlexDemure/gadasyncblock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Event loop lock detector for Python.


Installation

pip install gadasyncblock

Usage

import contextlib

from fastapi import FastAPI

from gadasyncblock import AsyncBlock
# logger: asyncio.detector

detector = AsyncBlock(timeout=1)

@contextlib.asynccontextmanager
async def lifespan(_: FastAPI):
    detector.start()
    yield
    detector.shutdown()


app = FastAPI(lifespan=lifespan)

@app.post("/run")
async def run():
    time.sleep(2)
    return {"message": "Blocked"}

About

Event loop lock detector for Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages