Skip to content

Commit a897e4b

Browse files
committed
fix: taskiq admin spawn_request
1 parent ced1909 commit a897e4b

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

‎taskiq/middlewares/taskiq_admin_middleware.py‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,26 @@ async def _spawn_request(
9292
"""
9393

9494
async def _send() -> None:
95-
client = self._get_client()
96-
97-
async with client.post(
98-
urljoin(self.url, endpoint),
99-
headers={"access-token": self.api_token},
100-
json=payload,
101-
) as resp:
102-
resp.raise_for_status()
103-
if not resp.ok:
104-
_logger.error(f"POST {endpoint} - {resp.status}")
95+
try:
96+
client = self._get_client()
97+
async with client.post(
98+
urljoin(self.url, endpoint),
99+
headers={"access-token": self.api_token},
100+
json=payload,
101+
) as resp:
102+
if not resp.ok:
103+
_logger.warning(
104+
"POST %s failed: %s %s",
105+
endpoint,
106+
resp.status,
107+
await resp.text(),
108+
)
109+
except Exception as exc:
110+
_logger.warning(
111+
"Failed to report to taskiq-admin %s: %r",
112+
endpoint,
113+
exc,
114+
)
105115

106116
task = asyncio.create_task(_send())
107117
self._pending.add(task)

0 commit comments

Comments
 (0)