mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-05-11 07:26:53 +00:00
feat(config): raise announce storage and API defaults to 2500
Increase announce_max_stored_* and announce_fetch_limit_* defaults from 1000/500 to 2500 so the API lists everything stored in the database by default. Matches better with public network usage where node counts are higher.
This commit is contained in:
@@ -2197,7 +2197,7 @@ class ReticulumMeshChat:
|
||||
def _default_announce_fetch_limit(self, aspect):
|
||||
ctx = self.current_context
|
||||
if not ctx or not ctx.config:
|
||||
return 500
|
||||
return 2500
|
||||
keys = {
|
||||
"lxmf.delivery": ctx.config.announce_fetch_limit_lxmf_delivery,
|
||||
"nomadnetwork.node": ctx.config.announce_fetch_limit_nomadnetwork_node,
|
||||
@@ -2206,10 +2206,10 @@ class ReticulumMeshChat:
|
||||
}
|
||||
cfg = keys.get(aspect)
|
||||
if cfg is None:
|
||||
return 500
|
||||
return 2500
|
||||
v = cfg.get()
|
||||
if v is None or v < 1:
|
||||
return 500
|
||||
return 2500
|
||||
return min(int(v), 100_000)
|
||||
|
||||
def get_lxst_version(self) -> str:
|
||||
|
||||
@@ -46,16 +46,16 @@ class AnnounceManager:
|
||||
|
||||
def _get_fetch_limit_for_aspect(self, aspect):
|
||||
if not self.config:
|
||||
return 500
|
||||
return 2500
|
||||
key = _ASPECT_FETCH_LIMIT_KEYS.get(aspect)
|
||||
if not key:
|
||||
return 500
|
||||
return 2500
|
||||
attr = getattr(self.config, key, None)
|
||||
if attr is None:
|
||||
return 500
|
||||
return 2500
|
||||
v = attr.get()
|
||||
if v is None or v < 1:
|
||||
return 500
|
||||
return 2500
|
||||
return min(v, 100_000)
|
||||
|
||||
def is_storing_announce_for_aspect(self, aspect, force_store: bool = False) -> bool:
|
||||
|
||||
@@ -413,37 +413,37 @@ class ConfigManager:
|
||||
True,
|
||||
)
|
||||
|
||||
# announce caps: max rows stored per aspect (oldest dropped). Default 1000.
|
||||
# announce caps: max rows stored per aspect (oldest dropped). Default 2500.
|
||||
self.announce_max_stored_lxmf_delivery = self.IntConfig(
|
||||
self,
|
||||
"announce_max_stored_lxmf_delivery",
|
||||
1000,
|
||||
2500,
|
||||
)
|
||||
self.announce_max_stored_nomadnetwork_node = self.IntConfig(
|
||||
self,
|
||||
"announce_max_stored_nomadnetwork_node",
|
||||
1000,
|
||||
2500,
|
||||
)
|
||||
self.announce_max_stored_lxmf_propagation = self.IntConfig(
|
||||
self,
|
||||
"announce_max_stored_lxmf_propagation",
|
||||
1000,
|
||||
2500,
|
||||
)
|
||||
# default API page size per aspect when limit query param omitted. Default 500.
|
||||
# default API page size per aspect when limit query param omitted. Default 2500.
|
||||
self.announce_fetch_limit_lxmf_delivery = self.IntConfig(
|
||||
self,
|
||||
"announce_fetch_limit_lxmf_delivery",
|
||||
500,
|
||||
2500,
|
||||
)
|
||||
self.announce_fetch_limit_nomadnetwork_node = self.IntConfig(
|
||||
self,
|
||||
"announce_fetch_limit_nomadnetwork_node",
|
||||
500,
|
||||
2500,
|
||||
)
|
||||
self.announce_fetch_limit_lxmf_propagation = self.IntConfig(
|
||||
self,
|
||||
"announce_fetch_limit_lxmf_propagation",
|
||||
500,
|
||||
2500,
|
||||
)
|
||||
# lxst.telephony shares LXMF caps in announce_manager aspect mapping
|
||||
self.announce_search_max_fetch = self.IntConfig(
|
||||
|
||||
@@ -127,7 +127,7 @@ class AnnounceDAO:
|
||||
search_term=None,
|
||||
identity_hash=None,
|
||||
destination_hash=None,
|
||||
limit=500,
|
||||
limit=2500,
|
||||
offset=0,
|
||||
):
|
||||
query = "SELECT * FROM announces WHERE 1=1"
|
||||
|
||||
@@ -221,13 +221,13 @@ def test_fetch_limit_invalid_falls_back_to_default(mock_db, mock_config):
|
||||
|
||||
manager = _make_manager(mock_db, mock_config)
|
||||
|
||||
assert manager._get_fetch_limit_for_aspect("lxmf.delivery") == 500
|
||||
assert manager._get_fetch_limit_for_aspect("lxmf.delivery") == 2500
|
||||
|
||||
|
||||
def test_fetch_limit_unknown_aspect_returns_default(mock_db, mock_config):
|
||||
manager = _make_manager(mock_db, mock_config)
|
||||
|
||||
assert manager._get_fetch_limit_for_aspect("unknown.aspect") == 500
|
||||
assert manager._get_fetch_limit_for_aspect("unknown.aspect") == 2500
|
||||
|
||||
|
||||
def test_fetch_limit_none_falls_back_to_default(mock_db, mock_config):
|
||||
@@ -236,7 +236,7 @@ def test_fetch_limit_none_falls_back_to_default(mock_db, mock_config):
|
||||
|
||||
manager = _make_manager(mock_db, mock_config)
|
||||
|
||||
assert manager._get_fetch_limit_for_aspect("lxmf.delivery") == 500
|
||||
assert manager._get_fetch_limit_for_aspect("lxmf.delivery") == 2500
|
||||
|
||||
|
||||
def test_get_filtered_announces_uses_clamped_fetch_limit(mock_db, mock_config):
|
||||
|
||||
@@ -109,8 +109,8 @@ def test_config_manager_smoke():
|
||||
config.auto_announce_enabled.set(True)
|
||||
assert config.auto_announce_enabled.get() is True
|
||||
|
||||
assert config.announce_max_stored_lxmf_delivery.get() == 1000
|
||||
assert config.announce_fetch_limit_lxmf_delivery.get() == 500
|
||||
assert config.announce_max_stored_lxmf_delivery.get() == 2500
|
||||
assert config.announce_fetch_limit_lxmf_delivery.get() == 2500
|
||||
assert config.discovered_interfaces_max_return.get() == 500
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user