agronholm / agronholm/mqttproto

async client block async loop for a long time

Đang mở
#31 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
23
Fork
6
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,

I think `stamina.retry_context` should be iterated with `async` , otherwise it will block the loop on connecting error.

see doc of [stamina](https://stamina.hynek.me/en/stable/tutorial.html#async)

```python
async def with_block(code: int) -> httpx.Response:
async for attempt in stamina.retry_context(on=httpx.HTTPError, attempts=3):
with attempt:
async with httpx.AsyncClient() as client:
resp = await client.get(f"https://httpbin.org/status/{code}")
resp.raise_for_status()

return resp
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.