Adding error statments with bail return, because having multiple errors is better than having none
This commit is contained in:
parent
211b286e31
commit
459b8cd842
|
@ -19,7 +19,7 @@ use solana_lite_rpc_services::{
|
|||
|
||||
use anyhow::bail;
|
||||
use jsonrpsee::{core::SubscriptionResult, server::ServerBuilder, PendingSubscriptionSink};
|
||||
use log::info;
|
||||
use log::{error, info};
|
||||
use prometheus::{opts, register_int_counter, IntCounter};
|
||||
use solana_lite_rpc_core::{
|
||||
block_store::{BlockInformation, BlockStore},
|
||||
|
@ -209,12 +209,14 @@ impl LiteBridge {
|
|||
let ws_server: AnyhowJoinHandle = tokio::spawn(async move {
|
||||
info!("Websocket Server started at {ws_addr:?}");
|
||||
ws_server_handle.stopped().await;
|
||||
error!("Websocket server stopped");
|
||||
bail!("Websocket server stopped");
|
||||
});
|
||||
|
||||
let http_server: AnyhowJoinHandle = tokio::spawn(async move {
|
||||
info!("HTTP Server started at {http_addr:?}");
|
||||
http_server_handle.stopped().await;
|
||||
error!("HTTP server stopped");
|
||||
bail!("HTTP server stopped");
|
||||
});
|
||||
|
||||
|
@ -227,7 +229,9 @@ impl LiteBridge {
|
|||
unreachable!();
|
||||
};
|
||||
|
||||
postgres.await
|
||||
let res = postgres.await;
|
||||
error!("postgres server stopped");
|
||||
res
|
||||
});
|
||||
|
||||
tokio::select! {
|
||||
|
|
|
@ -200,7 +200,6 @@ impl PostgresSession {
|
|||
log::error!("Connection to Postgres broke {err:?}");
|
||||
return;
|
||||
}
|
||||
|
||||
unreachable!("Postgres thread returned")
|
||||
});
|
||||
|
||||
|
@ -462,6 +461,7 @@ impl Postgres {
|
|||
}
|
||||
Err(tokio::sync::mpsc::error::TryRecvError::Empty) => break,
|
||||
Err(tokio::sync::mpsc::error::TryRecvError::Disconnected) => {
|
||||
log::error!("Postgres channel broke");
|
||||
bail!("Postgres channel broke")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ impl BlockListener {
|
|||
BLOCKS_IN_CONFIRMED_QUEUE.inc();
|
||||
}
|
||||
}
|
||||
|
||||
error!("Slot retry task exit");
|
||||
bail!("Slot retry task exit")
|
||||
})
|
||||
};
|
||||
|
@ -404,12 +404,15 @@ impl BlockListener {
|
|||
|
||||
tokio::select! {
|
||||
res = get_slot_task => {
|
||||
error!("Get slot task exited unexpectedly {res:?}");
|
||||
bail!("Get slot task exited unexpectedly {res:?}")
|
||||
}
|
||||
res = slot_retry_task => {
|
||||
error!("Slot retry task exited unexpectedly {res:?}");
|
||||
bail!("Slot retry task exited unexpectedly {res:?}")
|
||||
},
|
||||
res = futures::future::try_join_all(slot_indexer_tasks) => {
|
||||
error!("Slot indexer exited unexpectedly {res:?}");
|
||||
bail!("Slot indexer exited unexpectedly {res:?}")
|
||||
},
|
||||
}
|
||||
|
@ -437,7 +440,7 @@ impl BlockListener {
|
|||
// sleep
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
|
||||
}
|
||||
|
||||
error!("{errors} consecutive errors while polling processed blocks");
|
||||
bail!("{errors} consecutive errors while polling processed blocks")
|
||||
})
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ impl TpuService {
|
|||
log::info!("Got error while polling slot {}", err);
|
||||
}
|
||||
|
||||
error!("Reached max amount of errors to fetch latest slot, exiting poll slot loop");
|
||||
bail!("Reached max amount of errors to fetch latest slot, exiting poll slot loop")
|
||||
})
|
||||
}
|
||||
|
@ -258,12 +259,15 @@ impl TpuService {
|
|||
|
||||
tokio::select! {
|
||||
res = update_leader_schedule_service => {
|
||||
error!("Leader update Service {res:?}");
|
||||
bail!("Leader update Service {res:?}");
|
||||
},
|
||||
res = slot_poll_service => {
|
||||
error!("Slot Poll Service {res:?}");
|
||||
bail!("Slot Poll Service {res:?}");
|
||||
},
|
||||
res = estimated_slot_service => {
|
||||
error!("Estimated slot Service {res:?}");
|
||||
bail!("Estimated slot Service {res:?}");
|
||||
},
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ impl TransactionReplayer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
error!("transaction replay channel broken");
|
||||
bail!("transaction replay channel broken");
|
||||
})
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ impl TxSender {
|
|||
.max(1);
|
||||
}
|
||||
None => {
|
||||
log::error!("Channel Disconnected");
|
||||
bail!("Channel Disconnected");
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue