mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 21:30:40 +08:00
Better error handling on backgrounp task thread
This commit is contained in:
@ -43,8 +43,11 @@ def handle_request(
|
|||||||
log_context["api_url"] = url
|
log_context["api_url"] = url
|
||||||
|
|
||||||
async def inner():
|
async def inner():
|
||||||
|
try:
|
||||||
with get_logger().contextualize(**log_context):
|
with get_logger().contextualize(**log_context):
|
||||||
await PRAgent().handle_request(url, body)
|
await PRAgent().handle_request(url, body)
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().error(f"Failed to handle webhook: {e}")
|
||||||
|
|
||||||
background_tasks.add_task(inner)
|
background_tasks.add_task(inner)
|
||||||
|
|
||||||
|
@ -27,8 +27,11 @@ def handle_request(
|
|||||||
log_context["api_url"] = url
|
log_context["api_url"] = url
|
||||||
|
|
||||||
async def inner():
|
async def inner():
|
||||||
|
try:
|
||||||
with get_logger().contextualize(**log_context):
|
with get_logger().contextualize(**log_context):
|
||||||
await PRAgent().handle_request(url, body)
|
await PRAgent().handle_request(url, body)
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().error(f"Failed to handle webhook: {e}")
|
||||||
|
|
||||||
background_tasks.add_task(inner)
|
background_tasks.add_task(inner)
|
||||||
|
|
||||||
|
@ -29,8 +29,11 @@ def handle_request(background_tasks: BackgroundTasks, url: str, body: str, log_c
|
|||||||
log_context["api_url"] = url
|
log_context["api_url"] = url
|
||||||
|
|
||||||
async def inner():
|
async def inner():
|
||||||
|
try:
|
||||||
with get_logger().contextualize(**log_context):
|
with get_logger().contextualize(**log_context):
|
||||||
await PRAgent().handle_request(url, body)
|
await PRAgent().handle_request(url, body)
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().error(f"Failed to handle webhook: {e}")
|
||||||
|
|
||||||
background_tasks.add_task(inner)
|
background_tasks.add_task(inner)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user