From de0a77ed9391d2f20035b320b8d14c9d947457fb Mon Sep 17 00:00:00 2001 From: Duco Sebel <74970928+DCSBL@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:38:20 +0200 Subject: [PATCH] Retry failed requests with backoff to make unstable connections less flaky (#399) * Add backoff to retry request on error * Update tests * Use max_tries instead max_time to stabalize retry count --- .coverage | Bin 69632 -> 77824 bytes homewizard_energy/homewizard_energy.py | 2 ++ poetry.lock | 17 ++++++++++++++--- pyproject.toml | 1 + tests/test_homewizard_energy.py | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.coverage b/.coverage index a1aedc2c40ebf2e64c11417fda2cdd6e16ce6547..cb26aa60574a1d9f7f6d6193c4ca46a0aa489a48 100644 GIT binary patch literal 77824 zcmeI42bdI9*7xtd75dig?ka*Xl7~3tAxq9lGLm6n7={K0m>HNEl7Lv%HR7V~>MDj+ zF=sKZtEdciP?cectE$-0$7pw?-ZRze>}6y83_aJ@<4^ zn>wMSDwVsWyrQ(IDz_)8LntLfb8`tH7W`Kq{*ym35V{2TKh4s=BrVdl?B1j^lO)Wu zh_fI$+3AwFB-t+hLZZ~#7T*yovWj6x^bBC<6bxBj8R=#Bv%nqTc4JqD3oH zRTV|Wsfyrta>PlahD{%pJAK&j38Qj@ZMp45F8p-qk~=K7qI_NMs#Hbpl9H9F+>)}z zCB;QmC1p!Ya1l$2_<7Q63`jo(3 znOa}DdL@jv3X9fMm1npRUi`xD@GIfh<*}R=E$G(OnHvSeQ@E(4s!|E-XE%-7{0p}Z z?*HZc2Hzz=ze(_2v~p!``I5|A2G7n7UL3fav)?oMG8jb__(sbu4-bS#`agQN;e&<8 zkh^GQ`J$iSYneNyG6ioC@B(?*k~L+;_*SXJ=TKa}HdRryG}SfS8`#4C^o<0!PIt@9 z8P(#KZXIafRJO!QGf1%W2Sny1_dFeF^_Fe)c4AOYK|WZxX?O z|KYDHs#=!&_m3Sn!voJV%$xxYe(8bZLn!Qyzs>YKmU+lq8)c$j3Z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A$uCIkOR14B?(x-0fanhz`_k+Wfcin zumLQuBmoOGfXmBCzyb|m*>V!FFauapMgkUO0Ev7FGZkq)5Pm3Shwk60nd0IIn;NET919&m#c~CxCPF zNx*^$VBTC3uuuXxJC6h`kN`rSG+@W^fRiSZfCUb~iIYgc!Uo`ki6me_1902~60nc~2w9nc1q?t)%LFW3 z0770SV8H@#~(NWfwMV8_lR7!+Y{ zM-njq4@>t!sgrqsK*+=d%=ZH}KS%=R`2pKNv6T6JKuEj<% Any: diff --git a/poetry.lock b/poetry.lock index 244857d..9112802 100644 --- a/poetry.lock +++ b/poetry.lock @@ -147,8 +147,8 @@ files = [ [package.dependencies] aiohttp = [ {version = ">=3.7.0", markers = "python_version >= \"3.10\" and python_version < \"3.12\""}, - {version = ">=3.7.0,<3.8.dev0 || >=3.9.dev0", markers = "python_version >= \"3.12\""}, {version = ">=3.6.0", markers = "python_version >= \"3.8\" and python_version < \"3.10\""}, + {version = ">=3.7.0,<3.8.dev0 || >=3.9.dev0", markers = "python_version >= \"3.12\""}, ] pytest-asyncio = {version = ">=0.17.0", markers = "python_version >= \"3.7\""} @@ -221,6 +221,17 @@ files = [ [package.dependencies] cryptography = "*" +[[package]] +name = "backoff" +version = "2.2.1" +description = "Function decoration for backoff and retry" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8"}, + {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, +] + [[package]] name = "bandit" version = "1.7.9" @@ -1675,8 +1686,8 @@ astroid = ">=3.2.4,<=3.3.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, + {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, ] isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" mccabe = ">=0.6,<0.8" @@ -2294,4 +2305,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "116717a9eed2ff2ceade9263d933c11b738587f757dbe3defd53c8a80dfa27d8" +content-hash = "9235b22fbe1205c9b46086b6113d4d2c8f79def465b7e1de610339abfb9bfebc" diff --git a/pyproject.toml b/pyproject.toml index 364e13a..b90dea0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ python = "^3.9" aiohttp = ">=3.0.0" async-timeout = "^4.0.3" multidict = "^6.0.5" ## To fix aiohttp dependency at python 3.12 +backoff = "^2.2.1" [tool.poetry.dev-dependencies] aresponses = "^3.0.0" diff --git a/tests/test_homewizard_energy.py b/tests/test_homewizard_energy.py index 23e9362..f61f46d 100644 --- a/tests/test_homewizard_energy.py +++ b/tests/test_homewizard_energy.py @@ -565,7 +565,7 @@ async def test_request_timeout(): with pytest.raises(RequestError): await api.request("api/v1/data") - assert api._session.request.call_count == 1 + assert api._session.request.call_count == 5 async def test_close_when_out_of_scope():