https://github.com/alexdemure/gadasyncblock
Event loop lock detector for Python
https://github.com/alexdemure/gadasyncblock
asgi-lock async-block async-lock event-loop-lock event-loop-lock-detector
Last synced: 3 months ago
JSON representation
Event loop lock detector for Python
- Host: GitHub
- URL: https://github.com/alexdemure/gadasyncblock
- Owner: AlexDemure
- License: mit
- Created: 2025-04-24T07:08:00.000Z (about 1 year ago)
- Default Branch: production
- Last Pushed: 2025-04-30T09:00:54.000Z (about 1 year ago)
- Last Synced: 2025-06-25T19:02:47.683Z (11 months ago)
- Topics: asgi-lock, async-block, async-lock, event-loop-lock, event-loop-lock-detector
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Event loop lock detector for Python.
---
### Installation
```
pip install gadasyncblock
```
### Usage
```python
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"}
```
