Skip to content

Commit

Permalink
Add more logging
Browse files Browse the repository at this point in the history
Signed-off-by: Dylan Schultz <[email protected]>
  • Loading branch information
dylanschultzie committed Jan 2, 2025
1 parent 2322b5b commit f48f8e7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/cosmos/cosmos.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import requests
import logging

from datetime import datetime, timedelta, timezone

logger = logging.getLogger(__name__)

def modify_host(host_rpc):
host, port = host_rpc.split(":")
Expand All @@ -10,9 +13,10 @@ def modify_host(host_rpc):

def cosmos_health(host: str, acceptable_time_delta: int = 10) -> tuple:
acceptable_time_delta = timedelta(seconds=acceptable_time_delta)

logger.info(f"{host} | pre modification")
if not host.endswith("57"):
host = modify_host(host)
logger.info(f"{host} | post modification")

url = f"http://{host}/status"
response = requests.post(url)
Expand All @@ -22,6 +26,8 @@ def cosmos_health(host: str, acceptable_time_delta: int = 10) -> tuple:

latest_block_data = response.json()

logger.info(f"{host} | {latest_block_data}")

# Check sync status
if "result" not in latest_block_data:
return "Sync status check failed", 500
Expand Down

0 comments on commit f48f8e7

Please sign in to comment.