From 1a351e96b67437ea51dd9fbc0b749f2c476e2e8d Mon Sep 17 00:00:00 2001 From: Makar Shevchenko Date: Tue, 21 Nov 2023 15:43:30 +0300 Subject: [PATCH] PNLP-8011: fix ignite reconnect --- core/db_adapter/ignite_adapter.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/db_adapter/ignite_adapter.py b/core/db_adapter/ignite_adapter.py index 7eff3606..09c4c4fb 100644 --- a/core/db_adapter/ignite_adapter.py +++ b/core/db_adapter/ignite_adapter.py @@ -1,11 +1,12 @@ # coding: utf-8 import random from concurrent.futures._base import CancelledError +from typing import Optional import pyignite from pyignite import AioClient from pyignite.aio_cache import AioCache -from pyignite.exceptions import ReconnectError, SocketError +from pyignite.exceptions import ReconnectError, SocketError, CacheError import core.logging.logger_constants as log_const from core.db_adapter import error @@ -15,7 +16,7 @@ class IgniteAdapter(AsyncDBAdapter): - _client: AioClient + _client: Optional[AioClient] _cache = AioCache def __init__(self, config): @@ -80,9 +81,9 @@ async def get_cache(self): @property def _handled_exception(self): # TypeError is raised during reconnection if all nodes are exhausted - return OSError, SocketError, ReconnectError, CancelledError + return OSError, SocketError, ReconnectError, CancelledError, CacheError - async def _on_prepare(self): + def _on_prepare(self): self._client = None async def _get_counter_name(self):