mirror of
https://github.com/storytold/voder-proxy.git
synced 2026-10-19 07:43:12 +00:00
remove nightly-only build error source; remove unused imports
This commit is contained in:
@@ -2,7 +2,6 @@ use anyhow::Result as AnyhowResult;
|
|||||||
use futures::TryStreamExt;
|
use futures::TryStreamExt;
|
||||||
use hyper::http::HeaderValue;
|
use hyper::http::HeaderValue;
|
||||||
use hyper::{Body, Request, HeaderMap, Response, StatusCode};
|
use hyper::{Body, Request, HeaderMap, Response, StatusCode};
|
||||||
use hyper::body::Bytes;
|
|
||||||
|
|
||||||
/// NB: This much match the shape of SpeakRequest in the 'voder/tts_service' code.
|
/// NB: This much match the shape of SpeakRequest in the 'voder/tts_service' code.
|
||||||
/// This is used for both /speak and /speak_spectrogram requests.
|
/// This is used for both /speak and /speak_spectrogram requests.
|
||||||
|
|||||||
+7
-12
@@ -1,5 +1,3 @@
|
|||||||
#![feature(toowned_clone_into)]
|
|
||||||
|
|
||||||
#[macro_use] extern crate anyhow;
|
#[macro_use] extern crate anyhow;
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
#[macro_use] extern crate serde_derive;
|
#[macro_use] extern crate serde_derive;
|
||||||
@@ -9,22 +7,19 @@ pub mod newrelic_logger;
|
|||||||
pub mod speak_proxy;
|
pub mod speak_proxy;
|
||||||
|
|
||||||
use anyhow::Result as AnyhowResult;
|
use anyhow::Result as AnyhowResult;
|
||||||
use crate::newrelic_logger::{NewRelicLogger, MaybeNewRelicTransaction};
|
use crate::newrelic_logger::NewRelicLogger;
|
||||||
use crate::speak_proxy::speak_proxy_with_retry;
|
use crate::speak_proxy::speak_proxy_with_retry;
|
||||||
use futures::future::{self, Future};
|
use hyper::StatusCode;
|
||||||
use hyper::header::HeaderValue;
|
|
||||||
use hyper::http::header::HeaderName;
|
|
||||||
use hyper::server::conn::AddrStream;
|
use hyper::server::conn::AddrStream;
|
||||||
use hyper::service::{service_fn, make_service_fn};
|
use hyper::service::{service_fn, make_service_fn};
|
||||||
use hyper::{Body, Request, Response, Server};
|
use hyper::{Body, Request, Response, Server};
|
||||||
use hyper::{Method, StatusCode};
|
|
||||||
use rand::seq::IteratorRandom;
|
use rand::seq::IteratorRandom;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::net::{SocketAddr, IpAddr};
|
use std::net::IpAddr;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@@ -114,10 +109,10 @@ impl Router {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_request(req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
// fn debug_request(req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
||||||
let body_str = format!("{:?}", req);
|
// let body_str = format!("{:?}", req);
|
||||||
Ok(Response::new(Body::from(body_str)))
|
// Ok(Response::new(Body::from(body_str)))
|
||||||
}
|
// }
|
||||||
|
|
||||||
fn health_check_response(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
fn health_check_response(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
||||||
Ok(Response::new(Body::from("healthy")))
|
Ok(Response::new(Body::from("healthy")))
|
||||||
|
|||||||
+6
-17
@@ -1,26 +1,15 @@
|
|||||||
use anyhow::Result as AnyhowResult;
|
|
||||||
use crate::Router;
|
use crate::Router;
|
||||||
use crate::api::{ExternalSpeakRequest, ExternalHttpRequest, InternalSpeakRequest, ErrorResponse, ErrorType};
|
use crate::api::{ExternalHttpRequest, InternalSpeakRequest, ErrorResponse, ErrorType};
|
||||||
use crate::newrelic_logger::{NewRelicLogger, MaybeNewRelicTransaction};
|
use crate::newrelic_logger::{MaybeNewRelicTransaction};
|
||||||
use futures::TryStreamExt;
|
use hyper::Method;
|
||||||
use futures::future::{self, Future};
|
|
||||||
use hyper::header::HeaderValue;
|
use hyper::header::HeaderValue;
|
||||||
use hyper::http::header::HeaderName;
|
use hyper::http::header::HeaderName;
|
||||||
use hyper::server::conn::AddrStream;
|
use hyper::{Body, Request, Response, HeaderMap};
|
||||||
use hyper::service::{service_fn, make_service_fn};
|
|
||||||
use hyper::{Body, Request, Response, Server, HeaderMap};
|
|
||||||
use hyper::{Method, StatusCode};
|
|
||||||
use hyper_reverse_proxy::ProxyError;
|
|
||||||
use rand::seq::IteratorRandom;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::convert::Infallible;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::fmt::Display;
|
use std::net::IpAddr;
|
||||||
use std::net::{SocketAddr, IpAddr};
|
|
||||||
use std::str::FromStr;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{env, thread};
|
|
||||||
|
|
||||||
pub async fn speak_proxy_with_retry(
|
pub async fn speak_proxy_with_retry(
|
||||||
ip_addr: IpAddr,
|
ip_addr: IpAddr,
|
||||||
|
|||||||
Reference in New Issue
Block a user