Remove unused Arc/Mutex
Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
parent
a6195d68de
commit
f6b031eb1f
3 changed files with 3 additions and 7 deletions
|
@ -39,7 +39,7 @@ impl TryFrom<ForgejoHook> for Hook {
|
||||||
name: push.repository.name,
|
name: push.repository.name,
|
||||||
},
|
},
|
||||||
pusher: User {
|
pusher: User {
|
||||||
name: push.pusher.login,
|
name: push.pusher.username,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
_ => return Err(Error::UnsupportedHookConversion),
|
_ => return Err(Error::UnsupportedHookConversion),
|
||||||
|
|
|
@ -28,8 +28,6 @@ use crate::error::Error;
|
||||||
use crate::hooks::Hook;
|
use crate::hooks::Hook;
|
||||||
use crate::web::hooks;
|
use crate::web::hooks;
|
||||||
|
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
|
|
||||||
use camino::Utf8PathBuf;
|
use camino::Utf8PathBuf;
|
||||||
use clap::{command, value_parser, Arg};
|
use clap::{command, value_parser, Arg};
|
||||||
use hyper::{server::conn::http1, service::service_fn};
|
use hyper::{server::conn::http1, service::service_fn};
|
||||||
|
@ -62,7 +60,6 @@ async fn main() -> Result<!, Error> {
|
||||||
);
|
);
|
||||||
|
|
||||||
let tcp_bind = TcpListener::bind(config.addr).await?;
|
let tcp_bind = TcpListener::bind(config.addr).await?;
|
||||||
let value_tx = Arc::new(Mutex::new(value_tx));
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let value_tx = value_tx.clone();
|
let value_tx = value_tx.clone();
|
||||||
|
|
|
@ -18,7 +18,6 @@ use crate::hooks::{ForgejoHook, GitlabHook, Hook};
|
||||||
|
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
|
|
||||||
use bytes::{Buf, Bytes};
|
use bytes::{Buf, Bytes};
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
|
@ -98,12 +97,12 @@ async fn hooks_inner(req: Request<Incoming>, secret: &str) -> Result<Hook, Error
|
||||||
pub async fn hooks(
|
pub async fn hooks(
|
||||||
req: Request<Incoming>,
|
req: Request<Incoming>,
|
||||||
secret: &str,
|
secret: &str,
|
||||||
value_tx: Arc<Mutex<UnboundedSender<Hook>>>,
|
value_tx: UnboundedSender<Hook>,
|
||||||
) -> Result<Response<Full<Bytes>>, Infallible> {
|
) -> Result<Response<Full<Bytes>>, Infallible> {
|
||||||
match hooks_inner(req, secret).await {
|
match hooks_inner(req, secret).await {
|
||||||
Ok(wh) => {
|
Ok(wh) => {
|
||||||
debug!("Passed: {:?}", wh);
|
debug!("Passed: {:?}", wh);
|
||||||
value_tx.lock().unwrap().send(wh).unwrap();
|
value_tx.send(wh).unwrap();
|
||||||
Ok(Response::new(Full::new(Bytes::from("Hello, World!"))))
|
Ok(Response::new(Full::new(Bytes::from("Hello, World!"))))
|
||||||
}
|
}
|
||||||
Err(err) => error_res(err),
|
Err(err) => error_res(err),
|
||||||
|
|
Loading…
Reference in a new issue