Skip to content

Commit

Permalink
rm acdc from health check (#11583)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecsavvy authored Mar 11, 2025
1 parent 8bc0a7f commit 5beebac
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions packages/discovery-provider/src/queries/get_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@
trending_tracks_last_completion_redis_key,
user_balances_refresh_last_completion_redis_key,
)
from src.utils.web3_provider import get_web3

LOCAL_RPC = "http://chain:8545"


logger = logging.getLogger(__name__)
MONITORS = monitors.MONITORS
Expand Down Expand Up @@ -135,34 +131,6 @@ def _is_relay_healthy(relay_health_res):
return is_healthy


def _get_chain_health():
try:
health_res = requests.get(LOCAL_RPC + "/health", timeout=1)
chain_res = health_res.json()

web3 = get_web3(LOCAL_RPC)
latest_block = web3.eth.get_block("latest")
chain_res["block_number"] = latest_block.number
chain_res["hash"] = latest_block.hash.hex()
chain_res["chain_id"] = web3.eth.chain_id
get_signers_data = '{"method":"clique_getSigners","params":[]}'
signers_response = requests.post(LOCAL_RPC, data=get_signers_data)
signers_response_dict = signers_response.json()["result"]
chain_res["signers"] = signers_response_dict
get_snapshot_data = '{"method":"clique_getSnapshot","params":[]}'
snapshot_response = requests.post(LOCAL_RPC, data=get_snapshot_data)
snapshot_response_dict = snapshot_response.json()["result"]
chain_res["snapshot"] = snapshot_response_dict
return chain_res
except Exception as e:
# We use ganache locally in development, which doesn't have /health endpoint
# Don't log the error to prevent red herrings. Things will still work.
# TODO: Remove this check when we use nethermind in development
if shared_config["discprov"]["env"] != "dev":
logging.error("issue with chain health %s", exc_info=e)
pass


class GetHealthArgs(TypedDict):
# If True, returns db connection information
verbose: Optional[bool]
Expand Down Expand Up @@ -437,8 +405,6 @@ def get_health(args: GetHealthArgs, use_redis_cache: bool = True) -> Tuple[Dict,
else:
health_results["meets_min_requirements"] = True

health_results["chain_health"] = _get_chain_health()

relay_health = _get_relay_health()
if not _is_relay_healthy(relay_health):
errors.append("relay unhealthy")
Expand Down Expand Up @@ -510,14 +476,6 @@ def get_health(args: GetHealthArgs, use_redis_cache: bool = True) -> Tuple[Dict,
if not delist_statuses_ok:
errors.append("unhealthy delist statuses")

chain_health = health_results["chain_health"]
if chain_health and chain_health["status"] == "Unhealthy":
errors.append("unhealthy chain")

is_dev = shared_config["discprov"]["env"] == "dev"
if not is_dev and not chain_health:
errors.append("no chain response")

if verbose:
api_healthy, reason = is_api_healthy(url)
if not api_healthy:
Expand Down

0 comments on commit 5beebac

Please sign in to comment.