From 247ce8abbcd8e0248d5dd49cdfb37665ce956f96 Mon Sep 17 00:00:00 2001 From: Oleksandr Prudnikov <67575598+Grommash9@users.noreply.github.com> Date: Mon, 27 Jan 2025 08:15:44 +0000 Subject: [PATCH] add BlockNotFoundError to ignored errors for try call rpc block (#145) * add BlockNotFoundError to ignored errors for try call rpc block * add ruff --------- Co-authored-by: Oleksandr Prudnikov --- CHANGELOG.md | 3 +++ aiotx/clients/_base_client.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78ed367..14bcacf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [9.2.0] +- add BlockNotFoundError to ignored errors for try call rpc block + ## [9.1.0] - Fix TON monitoring - stop trying to pull not existing blocks diff --git a/aiotx/clients/_base_client.py b/aiotx/clients/_base_client.py index cff6d68..1696d83 100644 --- a/aiotx/clients/_base_client.py +++ b/aiotx/clients/_base_client.py @@ -6,7 +6,7 @@ import aiohttp -from aiotx.exceptions import RpcConnectionError +from aiotx.exceptions import BlockNotFoundError, RpcConnectionError from aiotx.log import logger @@ -169,7 +169,7 @@ async def _make_request_with_retry(self, request_func, *args, **kwargs): for attempt in range(self.max_retries): try: return await request_func(*args, **kwargs) - except RpcConnectionError as e: + except (RpcConnectionError, BlockNotFoundError) as e: if attempt < self.max_retries - 1: delay = self.retry_delay * (2**attempt) logger.warning(