stability
This commit is contained in:
parent
eeeab53e11
commit
b473d0921f
@ -87,6 +87,7 @@ def retry_last_log():
|
|||||||
return jsonify({"error": "No log files found"}), 404
|
return jsonify({"error": "No log files found"}), 404
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
logger.info(f"Processing latest log file: {latest_log_file}")
|
||||||
with open(latest_log_file, 'r') as f:
|
with open(latest_log_file, 'r') as f:
|
||||||
log = json.load(f)
|
log = json.load(f)
|
||||||
|
|
||||||
@ -804,7 +805,7 @@ async def save_token_info():
|
|||||||
with open('./logs/token_info.json', 'w') as f:
|
with open('./logs/token_info.json', 'w') as f:
|
||||||
json.dump(TOKENS_INFO, f, indent=2)
|
json.dump(TOKENS_INFO, f, indent=2)
|
||||||
|
|
||||||
async def get_transaction_details_with_retry(transaction_id, retry_delay = 7, max_retries = 11):
|
async def get_transaction_details_with_retry(transaction_id, retry_delay = 8, max_retries = 16):
|
||||||
# wait for the transaction to be confirmed
|
# wait for the transaction to be confirmed
|
||||||
# await async_client.wait_for_confirmation(Signature.from_string(transaction_id))
|
# await async_client.wait_for_confirmation(Signature.from_string(transaction_id))
|
||||||
# qwery every 5 seconds for the transaction details untill not None or 30 seconds
|
# qwery every 5 seconds for the transaction details untill not None or 30 seconds
|
||||||
@ -997,7 +998,7 @@ async def follow_move(move):
|
|||||||
print(f"Your balance: {your_balance_info['amount']}")
|
print(f"Your balance: {your_balance_info['amount']}")
|
||||||
else:
|
else:
|
||||||
print("No ballance found for {move['symbol_in']}. Skipping move.")
|
print("No ballance found for {move['symbol_in']}. Skipping move.")
|
||||||
send_telegram_message(f"No ballance found for {move['symbol_in']}. Skipping move.")
|
await send_telegram_message(f"No ballance found for {move['symbol_in']}. Skipping move.")
|
||||||
return
|
return
|
||||||
|
|
||||||
your_balance = your_balance_info['amount']
|
your_balance = your_balance_info['amount']
|
||||||
@ -1130,6 +1131,7 @@ async def heartbeat(websocket):
|
|||||||
|
|
||||||
first_subscription = True
|
first_subscription = True
|
||||||
async def subscribe_to_wallet():
|
async def subscribe_to_wallet():
|
||||||
|
global first_subscription
|
||||||
reconnect_delay = 5
|
reconnect_delay = 5
|
||||||
max_reconnect_delay = 60
|
max_reconnect_delay = 60
|
||||||
|
|
||||||
@ -1254,16 +1256,14 @@ def run_flask():
|
|||||||
app.run(debug=False, port=3001, use_reloader=False)
|
app.run(debug=False, port=3001, use_reloader=False)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Start Flask in a separate thread
|
|
||||||
flask_thread = threading.Thread(target=run_flask)
|
|
||||||
flask_thread.start()
|
|
||||||
|
|
||||||
# Create an event loop for the async tasks
|
# Create an event loop for the async tasks
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.run_until_complete(main())
|
loop.run_until_complete(main())
|
||||||
# Start Flask in a separate thread
|
# Start Flask in a separate thread
|
||||||
flask_thread = threading.Thread(target=run_flask)
|
# flask_thread = threading.Thread(target=run_flask)
|
||||||
flask_thread.start()
|
# flask_thread.start()
|
||||||
|
|
||||||
# Run the async main function
|
# Run the async main function
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
run_flask()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user