mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-06 09:47:51 +02:00
Update retry.py
This commit is contained in:
@@ -2,7 +2,7 @@ import asyncio
|
||||
import logging
|
||||
import random
|
||||
import time
|
||||
from typing import Optional
|
||||
from typing import Optional, Sequence
|
||||
|
||||
from langgraph.constants import CONFIG_KEY_RESUMING
|
||||
from langgraph.errors import GraphInterrupt
|
||||
@@ -38,7 +38,7 @@ def run_with_retry(
|
||||
# increment attempts
|
||||
attempts += 1
|
||||
# check if we should retry
|
||||
if isinstance(retry_policy.retry_on, (list, tuple)):
|
||||
if isinstance(retry_policy.retry_on, Sequence):
|
||||
if not isinstance(exc, tuple(retry_policy.retry_on)):
|
||||
raise
|
||||
elif isinstance(retry_policy.retry_on, type) and issubclass(retry_policy.retry_on, Exception):
|
||||
@@ -102,7 +102,7 @@ async def arun_with_retry(
|
||||
# increment attempts
|
||||
attempts += 1
|
||||
# check if we should retry
|
||||
if isinstance(retry_policy.retry_on, (list, tuple)):
|
||||
if isinstance(retry_policy.retry_on, Sequence):
|
||||
if not isinstance(exc, tuple(retry_policy.retry_on)):
|
||||
raise
|
||||
elif isinstance(retry_policy.retry_on, type) and issubclass(retry_policy.retry_on, Exception):
|
||||
|
||||
Reference in New Issue
Block a user