Skip to content

Commit

Permalink
Catch concurrent future cancelled exception instead of asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
ajhai committed Nov 4, 2024
1 parent 3dda9c9 commit 1e3b63d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llmstack/play/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import re
import threading
from concurrent.futures import CancelledError
from urllib.parse import quote

from diff_match_patch import diff_match_patch
Expand Down Expand Up @@ -82,8 +83,8 @@ def start_loop(loop):
def _done_callback(future):
try:
future.result()
except asyncio.CancelledError:
pass
except CancelledError:
logger.info("Task cancelled")
except Exception as e:
logger.exception(f"Task failed with error: {e}")
finally:
Expand Down

0 comments on commit 1e3b63d

Please sign in to comment.