From 087c6092e54b80c5e8f29cb85cc7f976fbfcc6ff Mon Sep 17 00:00:00 2001 From: Akshay Dahiya Date: Fri, 24 Nov 2023 21:48:56 +0530 Subject: [PATCH] chore: cleanup aiohttp library from rpc, fix duplicate logs --- .../auth/gunicorn_auth_entry_launcher.py | 6 ------ snapshotter/utils/rpc.py | 17 ----------------- 2 files changed, 23 deletions(-) diff --git a/snapshotter/auth/gunicorn_auth_entry_launcher.py b/snapshotter/auth/gunicorn_auth_entry_launcher.py index ed8c78f2..dfcbea4a 100644 --- a/snapshotter/auth/gunicorn_auth_entry_launcher.py +++ b/snapshotter/auth/gunicorn_auth_entry_launcher.py @@ -1,11 +1,8 @@ import logging import os -import sys from snapshotter.auth.conf import auth_settings from snapshotter.auth.server_entry import app -from snapshotter.utils.default_logger import FORMAT -from snapshotter.utils.default_logger import logger from snapshotter.utils.gunicorn import InterceptHandler from snapshotter.utils.gunicorn import StandaloneApplication from snapshotter.utils.gunicorn import StubbedGunicornLogger @@ -33,9 +30,6 @@ seen.add(name.split('.')[0]) logging.getLogger(name).handlers = [intercept_handler] - logger.add(sys.stdout, format=FORMAT, level=LOG_LEVEL, serialize=JSON_LOGS) - logger.add(sys.stderr, format=FORMAT, level=logging.ERROR, serialize=JSON_LOGS) - options = { 'bind': f'{auth_settings.bind.host}:{auth_settings.bind.port}', 'workers': WORKERS, diff --git a/snapshotter/utils/rpc.py b/snapshotter/utils/rpc.py index a609d0db..f4dc11da 100644 --- a/snapshotter/utils/rpc.py +++ b/snapshotter/utils/rpc.py @@ -6,9 +6,6 @@ import eth_abi import tenacity -from aiohttp import ClientSession -from aiohttp import ClientTimeout -from aiohttp import TCPConnector from async_limits import parse_many as limit_parse_many from eth_abi.codec import ABICodec from eth_utils import keccak @@ -92,8 +89,6 @@ def get_event_sig_and_abi(event_signatures, event_abis): class RpcHelper(object): - _aiohttp_tcp_connector: TCPConnector - _web3_aiohttp_client: ClientSession def __init__(self, rpc_settings: RPCConfigBase = settings.rpc, archive_mode=False): self._archive_mode = archive_mode @@ -108,8 +103,6 @@ def __init__(self, rpc_settings: RPCConfigBase = settings.rpc, archive_mode=Fals self._client = None self._async_transport = None self._rate_limit_lua_script_shas = None - self._aiohttp_tcp_connector = None - self._web3_aiohttp_client = None async def _load_rate_limit_shas(self, redis_conn): if self._rate_limit_lua_script_shas is not None: @@ -133,16 +126,6 @@ async def _init_http_clients(self): follow_redirects=False, transport=self._async_transport, ) - if self._aiohttp_tcp_connector is not None: - return - self._aiohttp_tcp_connector = TCPConnector( - keepalive_timeout=self._rpc_settings.connection_limits.keepalive_expiry, - limit=1000, - ) - self._web3_aiohttp_client = ClientSession( - connector=self._aiohttp_tcp_connector, - timeout=ClientTimeout(total=self._rpc_settings.request_time_out), - ) async def _load_async_web3_providers(self): for node in self._nodes: