Remove unused Arc/Mutex

Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2024-09-04 20:33:16 +02:00
parent a6195d68de
commit f6b031eb1f
3 changed files with 3 additions and 7 deletions

View file

@ -39,7 +39,7 @@ impl TryFrom<ForgejoHook> for Hook {
name: push.repository.name,
},
pusher: User {
name: push.pusher.login,
name: push.pusher.username,
},
}),
_ => return Err(Error::UnsupportedHookConversion),

View file

@ -28,8 +28,6 @@ use crate::error::Error;
use crate::hooks::Hook;
use crate::web::hooks;
use std::sync::{Arc, Mutex};
use camino::Utf8PathBuf;
use clap::{command, value_parser, Arg};
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 value_tx = Arc::new(Mutex::new(value_tx));
loop {
let value_tx = value_tx.clone();

View file

@ -18,7 +18,6 @@ use crate::hooks::{ForgejoHook, GitlabHook, Hook};
use std::convert::Infallible;
use std::io::Read;
use std::sync::{Arc, Mutex};
use bytes::{Buf, Bytes};
use hmac::{Hmac, Mac};
@ -98,12 +97,12 @@ async fn hooks_inner(req: Request<Incoming>, secret: &str) -> Result<Hook, Error
pub async fn hooks(
req: Request<Incoming>,
secret: &str,
value_tx: Arc<Mutex<UnboundedSender<Hook>>>,
value_tx: UnboundedSender<Hook>,
) -> Result<Response<Full<Bytes>>, Infallible> {
match hooks_inner(req, secret).await {
Ok(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!"))))
}
Err(err) => error_res(err),