added error handling for monitoring
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-12-12 22:41:21 +01:00
parent 80c3faec58
commit 809b252df7
2 changed files with 8 additions and 3 deletions

View File

@ -205,8 +205,7 @@ async fn compare_files_changes(
match modfiles.inevent.name { match modfiles.inevent.name {
Some(name) => { Some(name) => {
let filename = name.to_str().unwrap(); let filename = name.to_str().unwrap();
for sak in sas.clone().keys() { for (sak, sa) in sas.clone().iter_mut() {
let sa = sas.get(sak).unwrap();
if modfiles.inevent.wd == sa.wd { if modfiles.inevent.wd == sa.wd {
let handle: String; let handle: String;
if sa.filename.as_str() == "" { if sa.filename.as_str() == "" {

View File

@ -10,7 +10,13 @@ use tokio::sync::RwLock;
pub async fn apiserver(ctxarc: &Arc<RwLock<Context>>) -> io::Result<()> { pub async fn apiserver(ctxarc: &Arc<RwLock<Context>>) -> io::Result<()> {
let ctxarc = ctxarc.clone(); let ctxarc = ctxarc.clone();
let addr: String = { ctxarc.read().await.cfg.api.parse().unwrap() }; let addr: String = { ctxarc.read().await.cfg.api.parse().unwrap() };
let listener = TcpListener::bind(addr).await.unwrap(); let listener = match TcpListener::bind(addr).await {
Ok(l) => l,
Err(err) => {
println!("Error: {err}");
std::process::exit(1);
}
};
tokio::spawn(async move { tokio::spawn(async move {
loop { loop {