Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ttl short and ttl long for REST to be configurable #83

Open
wants to merge 2 commits into
base: mempool
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub struct Config {
pub electrum_txs_limit: usize,
pub electrum_banner: String,
pub mempool_backlog_stats_ttl: u64,
pub mempool_rest_ttl_short: u32,
pub mempool_rest_ttl_long: u32,
pub mempool_recent_txs_size: usize,
pub rest_default_block_limit: usize,
pub rest_default_chain_txs_per_page: usize,
Expand Down Expand Up @@ -217,6 +219,18 @@ impl Config {
.help("The number of seconds that need to pass before Mempool::update will update the latency histogram again.")
.default_value("10")
)
.arg(
Arg::with_name("mempool_rest_ttl_short")
.long("mempool-rest-ttl-short")
.help("The number of seconds frequently updated items in the REST API should be cached.")
.default_value("10")
)
.arg(
Arg::with_name("mempool_rest_ttl_long")
.long("mempool-rest-ttl-long")
.help("The number of seconds infrequently updated items in the REST API should be cached.")
.default_value("157784630")
)
.arg(
Arg::with_name("mempool_recent_txs_size")
.long("mempool-recent-txs-size")
Expand Down Expand Up @@ -500,6 +514,8 @@ impl Config {
rpc_socket_file,
monitoring_addr,
mempool_backlog_stats_ttl: value_t_or_exit!(m, "mempool_backlog_stats_ttl", u64),
mempool_rest_ttl_short: value_t_or_exit!(m, "mempool_rest_ttl_short", u32),
mempool_rest_ttl_long: value_t_or_exit!(m, "mempool_rest_ttl_long", u32),
mempool_recent_txs_size: value_t_or_exit!(m, "mempool_recent_txs_size", usize),
rest_default_block_limit: value_t_or_exit!(m, "rest_default_block_limit", usize),
rest_default_chain_txs_per_page: value_t_or_exit!(
Expand Down
Loading
Loading