From b0b48f555c96ba73c087d756446fea308956c9c2 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 13 Jun 2018 11:45:07 +0300 Subject: [PATCH] Reorder mempool polling and metrics serving --- src/bin/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index 0789275..e55e3c2 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -19,10 +19,11 @@ use electrs::{app::App, fn run_server(config: &Config) -> Result<()> { let signal = Waiter::new(); let metrics = Metrics::new(config.monitoring_addr); + metrics.start(); + let daemon = Daemon::new(config.network_type, &metrics)?; let store = DBStore::open(&config.db_path, StoreOptions { bulk_import: true }); let index = Index::load(&store, &metrics); - metrics.start(); let mut tip = index.update(&store, &daemon, &signal)?; store.compact_if_needed(); @@ -32,6 +33,8 @@ fn run_server(config: &Config) -> Result<()> { let app = App::new(store, index, daemon); let query = Query::new(app.clone(), &metrics); + query.update_mempool()?; // poll once before starting RPC server + let rpc = RPC::start(config.rpc_addr, query.clone(), &metrics); while let None = signal.wait(Duration::from_secs(5)) { query.update_mempool()?;