mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 02:45:18 +00:00
Better error handling on backgrounp task thread
This commit is contained in:
parent
c9c14c10b0
commit
d9a7dae6c4
3 changed files with 15 additions and 6 deletions
|
|
@ -43,8 +43,11 @@ def handle_request(
|
|||
log_context["api_url"] = url
|
||||
|
||||
async def inner():
|
||||
with get_logger().contextualize(**log_context):
|
||||
await PRAgent().handle_request(url, body)
|
||||
try:
|
||||
with get_logger().contextualize(**log_context):
|
||||
await PRAgent().handle_request(url, body)
|
||||
except Exception as e:
|
||||
get_logger().error(f"Failed to handle webhook: {e}")
|
||||
|
||||
background_tasks.add_task(inner)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,11 @@ def handle_request(
|
|||
log_context["api_url"] = url
|
||||
|
||||
async def inner():
|
||||
with get_logger().contextualize(**log_context):
|
||||
await PRAgent().handle_request(url, body)
|
||||
try:
|
||||
with get_logger().contextualize(**log_context):
|
||||
await PRAgent().handle_request(url, body)
|
||||
except Exception as e:
|
||||
get_logger().error(f"Failed to handle webhook: {e}")
|
||||
|
||||
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
|
||||
|
||||
async def inner():
|
||||
with get_logger().contextualize(**log_context):
|
||||
await PRAgent().handle_request(url, body)
|
||||
try:
|
||||
with get_logger().contextualize(**log_context):
|
||||
await PRAgent().handle_request(url, body)
|
||||
except Exception as e:
|
||||
get_logger().error(f"Failed to handle webhook: {e}")
|
||||
|
||||
background_tasks.add_task(inner)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue