File tree Expand file tree Collapse file tree 4 files changed +162
-88
lines changed
Expand file tree Collapse file tree 4 files changed +162
-88
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ mod test {
270270 let api_state = ApiState :: new (
271271 Arc :: new ( RwLock :: new ( chains) ) ,
272272 metrics_registry,
273- Arc :: new ( History :: new ( ) . await ) ,
273+ Arc :: new ( History :: new ( ) . await . unwrap ( ) ) ,
274274 )
275275 . await ;
276276
Original file line number Diff line number Diff line change @@ -44,22 +44,30 @@ pub async fn explorer(
4444 }
4545 if let Some ( query) = query_params. query {
4646 if let Ok ( tx_hash) = TxHash :: from_str ( & query) {
47- return Ok ( Json ( state. history . get_requests_by_tx_hash ( tx_hash) . await ) ) ;
47+ return Ok ( Json (
48+ state
49+ . history
50+ . get_requests_by_tx_hash ( tx_hash)
51+ . await
52+ . map_err ( |_| RestError :: TemporarilyUnavailable ) ?,
53+ ) ) ;
4854 }
4955 if let Ok ( sender) = Address :: from_str ( & query) {
5056 return Ok ( Json (
5157 state
5258 . history
5359 . get_requests_by_sender ( sender, query_params. chain_id )
54- . await ,
60+ . await
61+ . map_err ( |_| RestError :: TemporarilyUnavailable ) ?,
5562 ) ) ;
5663 }
5764 if let Ok ( sequence_number) = u64:: from_str ( & query) {
5865 return Ok ( Json (
5966 state
6067 . history
6168 . get_requests_by_sequence ( sequence_number, query_params. chain_id )
62- . await ,
69+ . await
70+ . map_err ( |_| RestError :: TemporarilyUnavailable ) ?,
6371 ) ) ;
6472 }
6573 return Err ( RestError :: InvalidQueryString ) ;
@@ -73,6 +81,7 @@ pub async fn explorer(
7381 query_params. min_timestamp ,
7482 query_params. max_timestamp ,
7583 )
76- . await ,
84+ . await
85+ . map_err ( |_| RestError :: TemporarilyUnavailable ) ?,
7786 ) )
7887}
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
102102 . map ( |chain_id| ( chain_id. clone ( ) , ApiBlockChainState :: Uninitialized ) )
103103 . collect ( ) ,
104104 ) ) ;
105- let history = Arc :: new ( History :: new ( ) . await ) ;
105+ let history = Arc :: new ( History :: new ( ) . await ? ) ;
106106 for ( chain_id, chain_config) in config. chains . clone ( ) {
107107 let keeper_metrics = keeper_metrics. clone ( ) ;
108108 let keeper_private_key_option = keeper_private_key_option. clone ( ) ;
You can’t perform that action at this time.
0 commit comments