Skip to content

AlexDemure/gadasyncblock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 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

detector = AsyncBlock(timeout=1)

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


app = FastAPI(lifespan=lifespan)

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

Releases

No releases published

Packages

No packages published

Languages