chore: change reload method
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Andre Henriques 2023-07-10 12:03:05 +01:00
parent d5859d0c7e
commit 53bda4eb06
2 changed files with 8 additions and 10 deletions

View File

@ -407,8 +407,6 @@ pub fn get_animation(name: &str, db: &State<DBPool>) -> Result<Option<Animation>
}) })
})?; })?;
println!("got here 4");
while let Some(key_frame_id) = map.next() { while let Some(key_frame_id) = map.next() {
let mut key_frame_id = key_frame_id?; let mut key_frame_id = key_frame_id?;
@ -430,13 +428,9 @@ pub fn get_animation(name: &str, db: &State<DBPool>) -> Result<Option<Animation>
key_frame_id.keyframe.settings.push(light_setting?); key_frame_id.keyframe.settings.push(light_setting?);
} }
println!("loop stuff");
animation.animation.key_frames.push(key_frame_id.keyframe); animation.animation.key_frames.push(key_frame_id.keyframe);
} }
println!("got here 6");
Ok(Some(animation.animation)) Ok(Some(animation.animation))
} }

View File

@ -110,7 +110,7 @@ fn ligth_controll(
return; return;
} }
let mut render = render.ok().unwrap(); let mut render = render.unwrap();
'mainloop: loop { 'mainloop: loop {
let action = action.try_recv(); let action = action.try_recv();
@ -118,10 +118,14 @@ fn ligth_controll(
if let Ok(action) = action { if let Ok(action) = action {
match action { match action {
Action::Reload => { Action::Reload => {
let result = render.load_config(); let new_render = render::Render::new(pool.clone());
if result.is_err() || result.as_ref().ok().is_none() {
println!("Ehh failed to load config i guess: {:?}", result.err()); if new_render.is_err() || new_render.as_ref().ok().is_none() {
println!("something every wrong {:?}", new_render.err());
continue;
} }
render = new_render.unwrap();
} }
Action::Clear => { Action::Clear => {
render.blank(); render.blank();