Browse Source

fix minor blemishes

master
Jonathan Strong 4 years ago
parent
commit
1da2c1ab09
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      src/influx.rs

+ 3
- 4
src/influx.rs View File

@@ -97,7 +97,7 @@ impl AsF64 for f32 { fn as_f64(x: Self) -> f64 { x as f64 } }
/// use logging::influx::*; /// use logging::influx::*;
/// ///
/// fn main() { /// fn main() {
/// let (tx, rx) = bounded(1024);
/// let (tx, rx) = crossbeam_channel::bounded(1024);
/// ///
/// // "shorthand" syntax /// // "shorthand" syntax
/// ///
@@ -359,7 +359,6 @@ impl InfluxWriter {
&[("db", db), ("precision", "ns")]) &[("db", db), ("precision", "ns")])
.expect("influx writer url should parse"); .expect("influx writer url should parse");
let thread = thread::Builder::new().name(format!("mm:inflx:{}", db)).spawn(move || { let thread = thread::Builder::new().name(format!("mm:inflx:{}", db)).spawn(move || {
use std::collections::VecDeque;
use std::time::*; use std::time::*;
use crossbeam_channel as chan; use crossbeam_channel as chan;


@@ -441,7 +440,7 @@ impl InfluxWriter {
let logger = thread_logger; let logger = thread_logger;
debug!(logger, "preparing to send http request to influx"; "buf.len()" => buf.len()); debug!(logger, "preparing to send http request to influx"; "buf.len()" => buf.len());
let start = Instant::now(); let start = Instant::now();
'a: for n_req in 0..N_HTTP_ATTEMPTS {
for n_req in 0..N_HTTP_ATTEMPTS {
let throttle = Duration::from_secs(2) * n_req * n_req; let throttle = Duration::from_secs(2) * n_req * n_req;
if n_req > 0 { if n_req > 0 {
warn!(logger, "InfluxWriter http thread: pausing before next request"; warn!(logger, "InfluxWriter http thread: pausing before next request";
@@ -462,7 +461,7 @@ impl InfluxWriter {
debug!(logger, "server responded ok: 204 NoContent"); debug!(logger, "server responded ok: 204 NoContent");
buf.clear(); buf.clear();
let mut resp = Some(Ok(Resp { buf, took })); let mut resp = Some(Ok(Resp { buf, took }));
'b: loop {
loop {
n_tx += 1; n_tx += 1;
match tx.try_send(resp.take().unwrap()) { match tx.try_send(resp.take().unwrap()) {
Ok(_) => { Ok(_) => {


Loading…
Cancel
Save