Skip to content

Commit

Permalink
chore: cleanup aiohttp library from rpc, fix duplicate logs
Browse files Browse the repository at this point in the history
  • Loading branch information
xadahiya committed Nov 24, 2023
1 parent cebbd9d commit 087c609
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
6 changes: 0 additions & 6 deletions snapshotter/auth/gunicorn_auth_entry_launcher.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down
17 changes: 0 additions & 17 deletions snapshotter/utils/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 087c609

Please sign in to comment.