expose resolved_url_cache_size
This commit is contained in:
parent
a41abc870d
commit
fc9b0af5b6
2 changed files with 11 additions and 3 deletions
|
@ -12,7 +12,7 @@ class ServerEnv(Env):
|
||||||
database_query_timeout=None, elastic_notifier_host=None, elastic_notifier_port=None,
|
database_query_timeout=None, elastic_notifier_host=None, elastic_notifier_port=None,
|
||||||
blocking_channel_ids=None, filtering_channel_ids=None, peer_hubs=None, peer_announce=None,
|
blocking_channel_ids=None, filtering_channel_ids=None, peer_hubs=None, peer_announce=None,
|
||||||
index_address_status=None, address_history_cache_size=None, daemon_ca_path=None,
|
index_address_status=None, address_history_cache_size=None, daemon_ca_path=None,
|
||||||
merkle_cache_size=None):
|
merkle_cache_size=None, resolved_url_cache_size=None):
|
||||||
super().__init__(db_dir, max_query_workers, chain, reorg_limit, prometheus_port, cache_all_tx_hashes,
|
super().__init__(db_dir, max_query_workers, chain, reorg_limit, prometheus_port, cache_all_tx_hashes,
|
||||||
cache_all_claim_txos, blocking_channel_ids, filtering_channel_ids, index_address_status)
|
cache_all_claim_txos, blocking_channel_ids, filtering_channel_ids, index_address_status)
|
||||||
self.daemon_url = daemon_url if daemon_url is not None else self.required('DAEMON_URL')
|
self.daemon_url = daemon_url if daemon_url is not None else self.required('DAEMON_URL')
|
||||||
|
@ -55,6 +55,8 @@ class ServerEnv(Env):
|
||||||
else self.integer('ADDRESS_HISTORY_CACHE_SIZE', 4096)
|
else self.integer('ADDRESS_HISTORY_CACHE_SIZE', 4096)
|
||||||
self.daemon_ca_path = daemon_ca_path if daemon_ca_path else None
|
self.daemon_ca_path = daemon_ca_path if daemon_ca_path else None
|
||||||
self.merkle_cache_size = merkle_cache_size if merkle_cache_size is not None else self.integer('MERKLE_CACHE_SIZE', 32768)
|
self.merkle_cache_size = merkle_cache_size if merkle_cache_size is not None else self.integer('MERKLE_CACHE_SIZE', 32768)
|
||||||
|
self.resolved_url_cache_size = resolved_url_cache_size if resolved_url_cache_size is not None else self.integer(
|
||||||
|
'RESOLVED_URL_CACHE_SIZE', 32768)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def contribute_to_arg_parser(cls, parser):
|
def contribute_to_arg_parser(cls, parser):
|
||||||
|
@ -111,6 +113,10 @@ class ServerEnv(Env):
|
||||||
default=cls.integer('MERKLE_CACHE_SIZE', 32768),
|
default=cls.integer('MERKLE_CACHE_SIZE', 32768),
|
||||||
help="Size of the lru cache of merkle trees for txs in blocks. "
|
help="Size of the lru cache of merkle trees for txs in blocks. "
|
||||||
"Can be set in the env with 'MERKLE_CACHE_SIZE'")
|
"Can be set in the env with 'MERKLE_CACHE_SIZE'")
|
||||||
|
parser.add_argument('--resolved_url_cache_size', type=int,
|
||||||
|
default=cls.integer('RESOLVED_URL_CACHE_SIZE', 32768),
|
||||||
|
help="Size of the lru cache of resolved urls. "
|
||||||
|
"Can be set in the env with 'RESOLVED_URL_CACHE_SIZE'")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_arg_parser(cls, args):
|
def from_arg_parser(cls, args):
|
||||||
|
@ -128,5 +134,5 @@ class ServerEnv(Env):
|
||||||
filtering_channel_ids=args.filtering_channel_ids, elastic_notifier_host=args.elastic_notifier_host,
|
filtering_channel_ids=args.filtering_channel_ids, elastic_notifier_host=args.elastic_notifier_host,
|
||||||
elastic_notifier_port=args.elastic_notifier_port, index_address_status=args.index_address_statuses,
|
elastic_notifier_port=args.elastic_notifier_port, index_address_status=args.index_address_statuses,
|
||||||
address_history_cache_size=args.address_history_cache_size, daemon_ca_path=args.daemon_ca_path,
|
address_history_cache_size=args.address_history_cache_size, daemon_ca_path=args.daemon_ca_path,
|
||||||
merkle_cache_size=args.merkle_cache_size
|
merkle_cache_size=args.merkle_cache_size, resolved_url_cache_size=args.resolved_url_cache_size
|
||||||
)
|
)
|
||||||
|
|
|
@ -198,7 +198,9 @@ class SessionManager:
|
||||||
self.cur_group = SessionGroup(0)
|
self.cur_group = SessionGroup(0)
|
||||||
self.txs_sent = 0
|
self.txs_sent = 0
|
||||||
self.start_time = time.time()
|
self.start_time = time.time()
|
||||||
self.resolve_cache = LRUCacheWithMetrics(16384, metric_name='resolved_url', namespace=NAMESPACE)
|
self.resolve_cache = LRUCacheWithMetrics(
|
||||||
|
env.resolved_url_cache_size, metric_name='resolved_url', namespace=NAMESPACE
|
||||||
|
)
|
||||||
self.notified_height: typing.Optional[int] = None
|
self.notified_height: typing.Optional[int] = None
|
||||||
# Cache some idea of room to avoid recounting on each subscription
|
# Cache some idea of room to avoid recounting on each subscription
|
||||||
self.subs_room = 0
|
self.subs_room = 0
|
||||||
|
|
Loading…
Reference in a new issue