better messages

This commit is contained in:
Dobromir Popov 2024-10-11 15:22:27 +03:00
parent 91e3a18a4d
commit 8033907431

View File

@ -1162,6 +1162,7 @@ async def subscribe_to_wallet():
while True:
subscription_id = await subscribe(websocket)
if subscription_id:
await send_telegram_message(f"Solana mainnet connected ({subscription_id})...")
process_task = asyncio.create_task(process_messages(websocket, subscription_id))
while True:
try:
@ -1189,7 +1190,7 @@ async def subscribe_to_wallet():
logger.error(f"WebSocket error: {e}")
except Exception as e:
logger.error(f"An unexpected error occurred: {e}")
await send_telegram_message("reconnecting...")
logger.info(f"Attempting to reconnect in {reconnect_delay} seconds...")
await asyncio.sleep(reconnect_delay)
reconnect_delay = min(reconnect_delay * 1.2, max_reconnect_delay)
@ -1214,7 +1215,6 @@ async def subscribe(websocket):
if 'result' in response_data:
subscription_id = response_data['result']
logger.info(f"Subscription successful. Subscription id: {subscription_id}")
await send_telegram_message("Solana mainnet connected... Listening for transactions.")
return subscription_id
else:
logger.warning(f"Unexpected response: {response_data}")