aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/bin
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-10 21:39:25 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-10 21:39:25 -0800
commit9a83067d04c9648416b92fc8d7b8a542b0b9aa96 (patch)
tree4622455b0f694262db5aa77314a3941ab37419fc /rust/src/bin
parentb75aa46db21c6f7a22b6fbbbd00b1e5d93e1d1ae (diff)
downloadfatcat-9a83067d04c9648416b92fc8d7b8a542b0b9aa96.tar.gz
fatcat-9a83067d04c9648416b92fc8d7b8a542b0b9aa96.zip
code docs/comments and rustfmt
Diffstat (limited to 'rust/src/bin')
-rw-r--r--rust/src/bin/fatcat-auth.rs6
-rw-r--r--rust/src/bin/fatcat-export.rs4
-rw-r--r--rust/src/bin/fatcatd.rs12
3 files changed, 13 insertions, 9 deletions
diff --git a/rust/src/bin/fatcat-auth.rs b/rust/src/bin/fatcat-auth.rs
index 85132023..0ba543b4 100644
--- a/rust/src/bin/fatcat-auth.rs
+++ b/rust/src/bin/fatcat-auth.rs
@@ -2,9 +2,9 @@
use clap::{App, SubCommand};
-use fatcat::{auth, editing, server};
use fatcat::errors::Result;
use fatcat::identifiers::FatcatId;
+use fatcat::{auth, editing, server};
use std::process;
use std::str::FromStr;
@@ -66,7 +66,9 @@ fn main() -> Result<()> {
}
// Then the ones that do
- let db_conn = server::database_worker_pool()?.get().expect("database pool");
+ let db_conn = server::database_worker_pool()?
+ .get()
+ .expect("database pool");
let confectionary = auth::env_confectionary()?;
match m.subcommand() {
("list-editors", Some(_subm)) => {
diff --git a/rust/src/bin/fatcat-export.rs b/rust/src/bin/fatcat-export.rs
index d6764dc6..0f5d04ac 100644
--- a/rust/src/bin/fatcat-export.rs
+++ b/rust/src/bin/fatcat-export.rs
@@ -15,15 +15,15 @@ use clap::{App, Arg};
use fatcat::entity_crud::*;
use fatcat::errors::Result;
use fatcat::identifiers::FatcatId;
-use fatcat::server::{DbConn, self};
+use fatcat::server::{self, DbConn};
use fatcat_api_spec::models::*;
use std::str::FromStr;
use uuid::Uuid;
-use std::thread;
use crossbeam_channel as channel;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter};
+use std::thread;
const CHANNEL_BUFFER_LEN: usize = 200;
diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs
index 816ea1f0..75a6f000 100644
--- a/rust/src/bin/fatcatd.rs
+++ b/rust/src/bin/fatcatd.rs
@@ -5,6 +5,8 @@ extern crate slog;
#[macro_use]
extern crate hyper;
+use cadence::prelude::*;
+use cadence::{BufferedUdpMetricSink, QueuingMetricSink, StatsdClient};
use clap::{App, Arg};
use fatcat::errors::Result;
use fatcat::server;
@@ -15,8 +17,6 @@ use iron_slog::{DefaultLogFormatter, LoggerMiddleware};
use sentry::integrations::panic;
use slog::{Drain, Logger};
use std::env;
-use cadence::{StatsdClient, QueuingMetricSink, BufferedUdpMetricSink};
-use cadence::prelude::*;
use std::net::UdpSocket;
// HTTP header middleware
@@ -32,7 +32,6 @@ impl AfterMiddleware for XClacksOverheadMiddleware {
}
}
-
/// Create custom server, wire it to the autogenerated router,
/// and pass it to the web server.
fn main() -> Result<()> {
@@ -70,7 +69,7 @@ fn main() -> Result<()> {
match env::var("FATCAT_STATSD_HOST") {
Err(_) => {
info!(logger, "no metrics recipient configured");
- },
+ }
Ok(host) => {
let port: u16 = match env::var("FATCAT_STATSD_PORT") {
Err(_) => cadence::DEFAULT_PORT,
@@ -80,7 +79,10 @@ fn main() -> Result<()> {
socket.set_nonblocking(true).unwrap();
let udp_sink = BufferedUdpMetricSink::from((host.as_ref(), port), socket).unwrap();
let queuing_sink = QueuingMetricSink::from(udp_sink);
- info!(logger, "sending statsd metrics via UDP to: {}:{}", host, port);
+ info!(
+ logger,
+ "sending statsd metrics via UDP to: {}:{}", host, port
+ );
server.metrics = StatsdClient::from_sink("fatcat.api", queuing_sink);
//server.metrics = StatsdClient::from_udp_host("fatcat.api", (host.as_ref(), port))?;
server.metrics.incr("restart").unwrap();