Clarify poll lifetime (#9922)

* Clarify poll filter.

* Fix RPC test.
This commit is contained in:
Tomasz Drwięga 2018-11-16 11:39:29 +00:00 committed by Andrew Jones
parent 0f90696528
commit 97c259858c
4 changed files with 8 additions and 13 deletions

View File

@ -503,6 +503,10 @@ usage! {
"--jsonrpc-max-payload=[MB]", "--jsonrpc-max-payload=[MB]",
"Specify maximum size for HTTP JSON-RPC requests in megabytes.", "Specify maximum size for HTTP JSON-RPC requests in megabytes.",
ARG arg_poll_lifetime: (u32) = 60u32, or |c: &Config| c.rpc.as_ref()?.poll_lifetime.clone(),
"--poll-lifetime=[S]",
"Set the RPC filter lifetime to S seconds. The filter has to be polled at least every S seconds , otherwise it is removed.",
["API and Console Options WebSockets"] ["API and Console Options WebSockets"]
FLAG flag_no_ws: (bool) = false, or |c: &Config| c.websockets.as_ref()?.disable.clone(), FLAG flag_no_ws: (bool) = false, or |c: &Config| c.websockets.as_ref()?.disable.clone(),
"--no-ws", "--no-ws",
@ -757,10 +761,6 @@ usage! {
"--gas-price-percentile=[PCT]", "--gas-price-percentile=[PCT]",
"Set PCT percentile gas price value from last 100 blocks as default gas price when sending transactions.", "Set PCT percentile gas price value from last 100 blocks as default gas price when sending transactions.",
ARG arg_poll_lifetime: (u32) = 60u32, or |c: &Config| c.mining.as_ref()?.poll_lifetime.clone(),
"--poll-lifetime=[S]",
"Set the lifetime of the internal index filter to S seconds.",
ARG arg_author: (Option<String>) = None, or |c: &Config| c.mining.as_ref()?.author.clone(), ARG arg_author: (Option<String>) = None, or |c: &Config| c.mining.as_ref()?.author.clone(),
"--author=[ADDRESS]", "--author=[ADDRESS]",
"Specify the block author (aka \"coinbase\") address for sending block rewards from sealed blocks. NOTE: MINING WILL NOT WORK WITHOUT THIS OPTION.", // Sealing/Mining Option "Specify the block author (aka \"coinbase\") address for sending block rewards from sealed blocks. NOTE: MINING WILL NOT WORK WITHOUT THIS OPTION.", // Sealing/Mining Option
@ -1224,6 +1224,7 @@ struct Rpc {
processing_threads: Option<usize>, processing_threads: Option<usize>,
max_payload: Option<usize>, max_payload: Option<usize>,
keep_alive: Option<bool>, keep_alive: Option<bool>,
poll_lifetime: Option<u32>,
} }
#[derive(Default, Debug, PartialEq, Deserialize)] #[derive(Default, Debug, PartialEq, Deserialize)]
@ -1316,7 +1317,6 @@ struct Mining {
relay_set: Option<String>, relay_set: Option<String>,
min_gas_price: Option<u64>, min_gas_price: Option<u64>,
gas_price_percentile: Option<usize>, gas_price_percentile: Option<usize>,
poll_lifetime: Option<u32>,
usd_per_tx: Option<String>, usd_per_tx: Option<String>,
usd_per_eth: Option<String>, usd_per_eth: Option<String>,
price_update_period: Option<String>, price_update_period: Option<String>,
@ -1690,6 +1690,7 @@ mod tests {
arg_jsonrpc_server_threads: None, arg_jsonrpc_server_threads: None,
arg_jsonrpc_threads: 4, arg_jsonrpc_threads: 4,
arg_jsonrpc_max_payload: None, arg_jsonrpc_max_payload: None,
arg_poll_lifetime: 60u32,
// WS // WS
flag_no_ws: false, flag_no_ws: false,
@ -1751,7 +1752,6 @@ mod tests {
arg_min_gas_price: Some(0u64), arg_min_gas_price: Some(0u64),
arg_usd_per_tx: "0.0001".into(), arg_usd_per_tx: "0.0001".into(),
arg_gas_price_percentile: 50usize, arg_gas_price_percentile: 50usize,
arg_poll_lifetime: 60u32,
arg_usd_per_eth: "auto".into(), arg_usd_per_eth: "auto".into(),
arg_price_update_period: "hourly".into(), arg_price_update_period: "hourly".into(),
arg_gas_floor_target: "8000000".into(), arg_gas_floor_target: "8000000".into(),
@ -1965,6 +1965,7 @@ mod tests {
processing_threads: None, processing_threads: None,
max_payload: None, max_payload: None,
keep_alive: None, keep_alive: None,
poll_lifetime: None,
}), }),
ipc: Some(Ipc { ipc: Some(Ipc {
disable: None, disable: None,
@ -2021,7 +2022,6 @@ mod tests {
relay_set: None, relay_set: None,
min_gas_price: None, min_gas_price: None,
gas_price_percentile: None, gas_price_percentile: None,
poll_lifetime: None,
usd_per_tx: None, usd_per_tx: None,
usd_per_eth: None, usd_per_eth: None,
price_update_period: Some("hourly".into()), price_update_period: Some("hourly".into()),

View File

@ -290,7 +290,6 @@ impl FullDependencies {
allow_pending_receipt_query: !self.geth_compatibility, allow_pending_receipt_query: !self.geth_compatibility,
send_block_number_in_get_work: !self.geth_compatibility, send_block_number_in_get_work: !self.geth_compatibility,
gas_price_percentile: self.gas_price_percentile, gas_price_percentile: self.gas_price_percentile,
poll_lifetime: self.poll_lifetime
} }
); );
handler.extend_with(client.to_delegate()); handler.extend_with(client.to_delegate());

View File

@ -64,8 +64,6 @@ pub struct EthClientOptions {
pub send_block_number_in_get_work: bool, pub send_block_number_in_get_work: bool,
/// Gas Price Percentile used as default gas price. /// Gas Price Percentile used as default gas price.
pub gas_price_percentile: usize, pub gas_price_percentile: usize,
/// Set the timeout for the internal poll manager
pub poll_lifetime: u32
} }
impl EthClientOptions { impl EthClientOptions {
@ -84,7 +82,6 @@ impl Default for EthClientOptions {
pending_nonce_from_queue: false, pending_nonce_from_queue: false,
allow_pending_receipt_query: true, allow_pending_receipt_query: true,
send_block_number_in_get_work: true, send_block_number_in_get_work: true,
poll_lifetime: 60u32,
gas_price_percentile: 50, gas_price_percentile: 50,
} }
} }

View File

@ -94,9 +94,8 @@ impl EthTester {
let hashrates = Arc::new(Mutex::new(HashMap::new())); let hashrates = Arc::new(Mutex::new(HashMap::new()));
let external_miner = Arc::new(ExternalMiner::new(hashrates.clone())); let external_miner = Arc::new(ExternalMiner::new(hashrates.clone()));
let gas_price_percentile = options.gas_price_percentile; let gas_price_percentile = options.gas_price_percentile;
let poll_lifetime = options.poll_lifetime;
let eth = EthClient::new(&client, &snapshot, &sync, &opt_ap, &miner, &external_miner, options).to_delegate(); let eth = EthClient::new(&client, &snapshot, &sync, &opt_ap, &miner, &external_miner, options).to_delegate();
let filter = EthFilterClient::new(client.clone(), miner.clone(), poll_lifetime).to_delegate(); let filter = EthFilterClient::new(client.clone(), miner.clone(), 60).to_delegate();
let reservations = Arc::new(Mutex::new(nonce::Reservations::new(runtime.executor()))); let reservations = Arc::new(Mutex::new(nonce::Reservations::new(runtime.executor())));
let dispatcher = FullDispatcher::new(client.clone(), miner.clone(), reservations, gas_price_percentile); let dispatcher = FullDispatcher::new(client.clone(), miner.clone(), reservations, gas_price_percentile);