Browse Source

nanosleep for no-thrash

master
Jonathan Strong 7 years ago
parent
commit
b74ab109b1
4 changed files with 5 additions and 2 deletions
  1. +1
    -0
      Cargo.toml
  2. +1
    -1
      src/influx.rs
  3. +2
    -1
      src/latency.rs
  4. +1
    -0
      src/lib.rs

+ 1
- 0
Cargo.toml View File

@@ -13,6 +13,7 @@ pub-sub = "2.0"
slog = "2.0.6" slog = "2.0.6"
sloggers = "0.2" sloggers = "0.2"
slog-term = "2" slog-term = "2"
shuteye = "^0"


windows = { path = "../windows" } windows = { path = "../windows" }
money = { path = "../money" } money = { path = "../money" }


+ 1
- 1
src/influx.rs View File

@@ -417,7 +417,7 @@ impl InfluxWriter {


if !rcvd_msg { if !rcvd_msg {
#[cfg(feature = "no-thrash")] #[cfg(feature = "no-thrash")]
thread::sleep(Duration::from_millis(1) / 10);
shuteye::sleep(Duration::new(0, 5000));
} }
} }




+ 2
- 1
src/latency.rs View File

@@ -10,6 +10,7 @@ use pub_sub::PubSub;
use zmq; use zmq;
use influent::measurement::{Measurement, Value}; use influent::measurement::{Measurement, Value};
use sloggers::types::Severity; use sloggers::types::Severity;
use shuteye;


use windows::{DurationWindow, Incremental}; use windows::{DurationWindow, Incremental};
use money::{Ticker, Side, ByExchange, Exchange}; use money::{Ticker, Side, ByExchange, Exchange};
@@ -402,7 +403,7 @@ impl Manager {
debug!(logger, "sent broadcast"); debug!(logger, "sent broadcast");
} else { } else {
#[cfg(feature = "no-thrash")] #[cfg(feature = "no-thrash")]
thread::sleep(Duration::from_millis(1) / 10);
shuteye::sleep(Duration::new(0, 1000));
} }


if terminate { break } if terminate { break }


+ 1
- 0
src/lib.rs View File

@@ -15,6 +15,7 @@ extern crate termion;
extern crate pub_sub; extern crate pub_sub;
extern crate sloggers; extern crate sloggers;
extern crate slog_term; extern crate slog_term;
extern crate shuteye;


extern crate windows; extern crate windows;




Loading…
Cancel
Save