Hoist Historian input

This commit is contained in:
Greg Fitzgerald
2018-05-02 16:35:37 -06:00
parent c5cc91443e
commit 4b9f115586
5 changed files with 62 additions and 40 deletions

View File

@@ -15,6 +15,7 @@ use std::env;
use std::io::{stdin, stdout, Read};
use std::process::exit;
use std::sync::atomic::AtomicBool;
use std::sync::mpsc::sync_channel;
use std::sync::{Arc, Mutex};
fn print_usage(program: &str, opts: Options) {
@@ -95,12 +96,14 @@ fn main() {
acc.register_entry_id(&last_id);
}
let historian = Historian::new(&last_id, Some(1000));
let (input, event_receiver) = sync_channel(10_000);
let historian = Historian::new(event_receiver, &last_id, Some(1000));
let exit = Arc::new(AtomicBool::new(false));
let skel = Arc::new(Mutex::new(AccountantSkel::new(
acc,
last_id,
stdout(),
input,
historian,
)));
let threads = AccountantSkel::serve(&skel, &addr, exit.clone()).unwrap();