mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 09:54:09 +01:00
Don't get stuck when RPC update cannot be sent
This commit is contained in:
parent
10aeea89be
commit
44c4ba491f
@ -1,13 +1,16 @@
|
|||||||
extern crate simplelog;
|
|
||||||
|
|
||||||
extern crate argparse;
|
extern crate argparse;
|
||||||
extern crate crossbeam;
|
extern crate crossbeam;
|
||||||
extern crate indexrs;
|
extern crate indexrs;
|
||||||
|
extern crate simplelog;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
|
||||||
use argparse::{ArgumentParser, StoreFalse, StoreTrue};
|
use argparse::{ArgumentParser, StoreFalse, StoreTrue};
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use indexrs::{daemon, index, query, rpc, store, waiter};
|
use indexrs::{daemon, index, query, rpc, store, waiter};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct Config {
|
struct Config {
|
||||||
log_file: String,
|
log_file: String,
|
||||||
enable_indexing: bool,
|
enable_indexing: bool,
|
||||||
@ -96,7 +99,9 @@ fn run_server(config: &Config) {
|
|||||||
if config.enable_indexing {
|
if config.enable_indexing {
|
||||||
index.update(&store, &daemon);
|
index.update(&store, &daemon);
|
||||||
}
|
}
|
||||||
tx.send(rpc::Message::Block(blockhash)).unwrap();
|
if let Err(e) = tx.try_send(rpc::Message::Block(blockhash)) {
|
||||||
|
debug!("failed to send update for {}: {:?}", blockhash, e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -117,6 +122,7 @@ fn setup_logging(config: &Config) {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
),
|
),
|
||||||
]).unwrap();
|
]).unwrap();
|
||||||
|
info!("config: {:?}", config);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user