move signal handling out to main
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
1108235c63
commit
89ab687f16
3 changed files with 55 additions and 51 deletions
|
@ -6,7 +6,7 @@ use std::{
|
|||
time::SystemTime,
|
||||
};
|
||||
|
||||
use tokio::runtime;
|
||||
use tokio::{runtime, sync::broadcast};
|
||||
|
||||
use crate::{config::Config, log::LogLevelReloadHandles};
|
||||
|
||||
|
@ -22,6 +22,9 @@ pub struct Server {
|
|||
/// command to initiate shutdown.
|
||||
pub shutdown: Mutex<Option<axum_server::Handle>>,
|
||||
|
||||
/// Reload/shutdown signal
|
||||
pub signal: broadcast::Sender<&'static str>,
|
||||
|
||||
/// Reload/shutdown desired indicator; when false, shutdown is desired. This
|
||||
/// is an observable used on shutdown and modifying is not recommended.
|
||||
pub reload: AtomicBool,
|
||||
|
@ -51,6 +54,7 @@ impl Server {
|
|||
config,
|
||||
started: SystemTime::now(),
|
||||
shutdown: Mutex::new(None),
|
||||
signal: broadcast::channel::<&'static str>(1).0,
|
||||
reload: AtomicBool::new(false),
|
||||
interrupt: AtomicBool::new(false),
|
||||
runtime,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue