ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixup

authored by

marshmallow and committed by
marshmallow
611bde24 820b77c1

+18 -14
+1 -1
wire/cli/src/apply.rs
··· 123 123 reboot: args.reboot, 124 124 should_apply_locally, 125 125 handle_unreachable: args.handle_unreachable.clone().into(), 126 - should_shutdown: should_shutdown.clone() 126 + should_shutdown: should_shutdown.clone(), 127 127 }; 128 128 129 129 GoalExecutor::new(context)
+2 -4
wire/cli/src/main.rs
··· 31 31 32 32 mod apply; 33 33 mod cli; 34 - mod tracing_setup; 35 34 mod sigint; 35 + mod tracing_setup; 36 36 37 37 #[cfg(feature = "dhat-heap")] 38 38 #[global_allocator] ··· 63 63 miette::bail!("Nix is not available on this system."); 64 64 } 65 65 66 - let signals = Signals::new([ 67 - SIGINT, 68 - ]).into_diagnostic()?; 66 + let signals = Signals::new([SIGINT]).into_diagnostic()?; 69 67 let signals_handle = signals.handle(); 70 68 let should_shutdown = Arc::new(AtomicBool::new(false)); 71 69 let signals_task = tokio::spawn(handle_signals(signals, should_shutdown.clone()));
+4 -3
wire/cli/src/sigint.rs
··· 7 7 use signal_hook_tokio::Signals; 8 8 9 9 use futures::stream::StreamExt; 10 - use tracing::{info}; 10 + use tracing::info; 11 11 12 12 pub(crate) async fn handle_signals(mut signals: Signals, should_shutdown: Arc<AtomicBool>) { 13 13 while let Some(signal) = signals.next().await { 14 - if let SIGINT = signal && !should_shutdown.load(std::sync::atomic::Ordering::Relaxed) { 14 + if let SIGINT = signal 15 + && !should_shutdown.load(std::sync::atomic::Ordering::Relaxed) 16 + { 15 17 info!("Received SIGINT, attempting to shut down executor threads."); 16 18 should_shutdown.store(true, std::sync::atomic::Ordering::Relaxed); 17 19 } 18 20 } 19 21 } 20 -
+1 -1
wire/lib/src/errors.rs
··· 372 372 url("{DOCS_URL}#{}", self.code().unwrap()) 373 373 )] 374 374 #[error("SIGINT recieved, shut down")] 375 - Sigint 375 + Sigint, 376 376 }
+10 -5
wire/lib/src/hive/node.rs
··· 116 116 reboot: false, 117 117 should_apply_locally: false, 118 118 handle_unreachable: HandleUnreachable::default(), 119 - should_shutdown: Arc::new(AtomicBool::new(false)) 119 + should_shutdown: Arc::new(AtomicBool::new(false)), 120 120 } 121 121 } 122 122 } ··· 307 307 pub reboot: bool, 308 308 pub should_apply_locally: bool, 309 309 pub handle_unreachable: HandleUnreachable, 310 - pub should_shutdown: Arc<AtomicBool> 310 + pub should_shutdown: Arc<AtomicBool>, 311 311 } 312 312 313 313 #[enum_dispatch(ExecuteStep)] ··· 347 347 348 348 /// returns Err if the application should shut down. 349 349 fn app_shutdown_guard(context: &Context) -> Result<(), HiveLibError> { 350 - if context.should_shutdown.load(std::sync::atomic::Ordering::Relaxed) { 351 - return Err(HiveLibError::Sigint) 350 + if context 351 + .should_shutdown 352 + .load(std::sync::atomic::Ordering::Relaxed) 353 + { 354 + return Err(HiveLibError::Sigint); 352 355 } 353 356 354 357 Ok(()) ··· 816 819 817 820 let name = &Name(function_name!().into()); 818 821 let context = Context::create_test_context(location, name, &mut node); 819 - context.should_shutdown.store(true, std::sync::atomic::Ordering::Relaxed); 822 + context 823 + .should_shutdown 824 + .store(true, std::sync::atomic::Ordering::Relaxed); 820 825 let executor = GoalExecutor::new(context); 821 826 let status = executor.execute().await; 822 827