Configure Bigtable's timeout, enabling by default (#14657)

* Configure bigtable's timeout when read-only

* Review comments

* Apply nits (thanks!)

Co-authored-by: Michael Vines <mvines@gmail.com>

* Timeout in the streamed decoding as well

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
Ryo Onodera
2021-01-19 22:57:16 +09:00
committed by GitHub
parent 8a604de3c3
commit dcaa025822
6 changed files with 74 additions and 24 deletions

View File

@ -81,6 +81,7 @@ use std::{
mpsc::{channel, Receiver, Sender},
Arc, Mutex, RwLock,
},
time::Duration,
};
use tokio::runtime;
@ -115,6 +116,7 @@ pub struct JsonRpcConfig {
pub max_multiple_accounts: Option<usize>,
pub account_indexes: HashSet<AccountIndex>,
pub rpc_threads: usize,
pub rpc_bigtable_timeout: Option<Duration>,
}
#[derive(Clone)]
@ -738,7 +740,12 @@ impl JsonRpcRequestProcessor {
bigtable_blocks.retain(|&slot| slot <= end_slot);
bigtable_blocks
})
.unwrap_or_else(|_| vec![]));
.map_err(|_| {
Error::invalid_params(
"BigTable query failed (maybe timeout due to too large range?)"
.to_string(),
)
})?);
}
}