From abeb14c17fd705440005c43f2614e44b98e1f21f Mon Sep 17 00:00:00 2001 From: Serge Farny Date: Tue, 5 Mar 2024 16:36:50 +0100 Subject: [PATCH] service-mango-health: add config for snapshot interval (reduce memory pressure) (cherry picked from commit 78ea5e220cc032d6a280b0f3c66cb94051da3267) --- bin/service-mango-health/conf/example-config.toml | 1 + bin/service-mango-health/conf/template-config.toml | 1 + bin/service-mango-health/src/configuration.rs | 2 ++ bin/service-mango-health/src/processors/data.rs | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/service-mango-health/conf/example-config.toml b/bin/service-mango-health/conf/example-config.toml index edbb9e493..40b290f1b 100644 --- a/bin/service-mango-health/conf/example-config.toml +++ b/bin/service-mango-health/conf/example-config.toml @@ -1,6 +1,7 @@ rpc_ws_url = "wss://mango.rpcpool.com/" rpc_http_url = "http://mango.rpcpool.com/" mango_group = "78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX" +snapshot_interval_secs = 900 # [postgres] # connection_string = "$PG_CONNECTION_STRING" diff --git a/bin/service-mango-health/conf/template-config.toml b/bin/service-mango-health/conf/template-config.toml index a7684de85..ac5fcee40 100644 --- a/bin/service-mango-health/conf/template-config.toml +++ b/bin/service-mango-health/conf/template-config.toml @@ -1,6 +1,7 @@ rpc_http_url = "$RPC_HTTP_URL" rpc_ws_url = "$RPC_WS_URL" mango_group = "78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX" +snapshot_interval_secs = 900 [postgres] connection_string = "$PG_CONNECTION_STRING" diff --git a/bin/service-mango-health/src/configuration.rs b/bin/service-mango-health/src/configuration.rs index 76ca7944d..3dc95cb33 100644 --- a/bin/service-mango-health/src/configuration.rs +++ b/bin/service-mango-health/src/configuration.rs @@ -15,6 +15,8 @@ pub struct Configuration { pub computing_configuration: ComputingConfiguration, pub logging_configuration: LoggingConfiguration, pub persistence_configuration: PersistenceConfiguration, + + pub snapshot_interval_secs: u64, } #[derive(Clone, Debug, Deserialize)] diff --git a/bin/service-mango-health/src/processors/data.rs b/bin/service-mango-health/src/processors/data.rs index 24c5c85d8..feb24357f 100644 --- a/bin/service-mango-health/src/processors/data.rs +++ b/bin/service-mango-health/src/processors/data.rs @@ -200,7 +200,7 @@ impl DataProcessor { mango_group, get_multiple_accounts_count: 100, parallel_rpc_requests: 10, - snapshot_interval: Duration::from_secs(5 * 60), + snapshot_interval: Duration::from_secs(configuration.snapshot_interval_secs), min_slot: first_websocket_slot + 10, }, mango_oracles,