Skip to content

Commit c3979bf

Browse files
Merge pull request #263 from symphony-youri/prepare-2-2-1-release
Prepare 2.2.1 release
2 parents 7c1fec8 + 89ac0ec commit c3979bf

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "symphony_bdk_python"
3-
version = "2.2.0"
3+
version = "2.2.1"
44
license = "Apache-2.0"
55
description = "Symphony Bot Development Kit for Python"
66
readme = "README.md"

symphony/bdk/core/retry/strategy.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from aiohttp import ClientConnectorError
1+
from aiohttp import ClientConnectionError
2+
from asyncio import TimeoutError
23
from tenacity import RetryCallState
34

45
from symphony.bdk.core.auth.exception import AuthUnauthorizedError
@@ -14,12 +15,12 @@ def is_client_error(exception: Exception) -> bool:
1415

1516

1617
def is_client_timeout_error(exception: Exception):
17-
"""Checks if the exception is a :py:class:`ClientConnectorError` with a :py:class:`TimeoutError` as cause
18+
"""Checks if the exception is a client timeout error
1819
1920
:param exception: The exception to be checked
2021
:return: True if checks the predicate, False otherwise
2122
"""
22-
return isinstance(exception, ClientConnectorError) and isinstance(exception.__cause__, TimeoutError)
23+
return isinstance(exception, ClientConnectionError) or isinstance(exception, TimeoutError)
2324

2425

2526
def can_authentication_be_retried(exception: Exception) -> bool:

tests/core/retry/strategy_test.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
from unittest.mock import Mock, AsyncMock
33

4+
import aiohttp
45
import pytest
56
from aiohttp import ClientConnectorError
67

@@ -108,15 +109,16 @@ async def test_should_retry():
108109
strategies = [TestAuthenticationStrategy(), TestRefreshSessionStrategy(), TestReadDatafeedStrategy()]
109110
connection_key = Mock()
110111
connection_key.ssl = "ssl"
111-
exception_from_a_timeout = ClientConnectorError(connection_key, TimeoutError())
112-
exception_from_a_timeout.__cause__ = TimeoutError()
113-
thing = FixedChainedExceptions([ApiException(429), ApiException(500), exception_from_a_timeout])
112+
exception_from_client = aiohttp.ClientConnectionError
113+
exception_from_a_timeout = asyncio.TimeoutError()
114+
thing = FixedChainedExceptions([ApiException(429), ApiException(500),
115+
exception_from_client, exception_from_a_timeout])
114116

115117
for s in strategies:
116-
s._retry_config = minimal_retry_config_with_attempts(4)
118+
s._retry_config = minimal_retry_config_with_attempts(5)
117119

118120
value = await s._retryable_coroutine(thing)
119121

120122
assert value is True
121-
assert thing.call_count == 4
123+
assert thing.call_count == 5
122124
thing.reset() # Reset the counters

0 commit comments

Comments
 (0)