|
|
@ -158,7 +158,7 @@ async fn service_fn(SupervisorTaskState {shared, mut recv, mut shutdown}: Superv
|
|
|
|
// The command stream to dispatch to the worker tasks
|
|
|
|
// The command stream to dispatch to the worker tasks
|
|
|
|
let command_dispatch = async {
|
|
|
|
let command_dispatch = async {
|
|
|
|
while let Some(req) = recv.recv().await {
|
|
|
|
while let Some(req) = recv.recv().await {
|
|
|
|
//TODO: Dispatch
|
|
|
|
todo!("Dispatch to child(s)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TerminationKind::Graceful
|
|
|
|
TerminationKind::Graceful
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -170,12 +170,12 @@ async fn service_fn(SupervisorTaskState {shared, mut recv, mut shutdown}: Superv
|
|
|
|
{
|
|
|
|
{
|
|
|
|
use SupervisorControl::*;
|
|
|
|
use SupervisorControl::*;
|
|
|
|
match value {
|
|
|
|
match value {
|
|
|
|
Initialise => (),
|
|
|
|
Initialise => info!("Initialised"),
|
|
|
|
Signal(None) => return TerminationKind::SignalHup,
|
|
|
|
Signal(None) => return TerminationKind::SignalHup,
|
|
|
|
Signal(Some(to)) => return TerminationKind::SignalTimeout(to),
|
|
|
|
Signal(Some(to)) => return TerminationKind::SignalTimeout(to),
|
|
|
|
Drop => return TerminationKind::Immediate,
|
|
|
|
Drop => return TerminationKind::Immediate,
|
|
|
|
Restart => (),
|
|
|
|
Restart => todo!("not implemented"),
|
|
|
|
TaskLimit(_limit) => (),
|
|
|
|
TaskLimit(_limit) => todo!("not implemented"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TerminationKind::Graceful
|
|
|
|
TerminationKind::Graceful
|
|
|
@ -187,18 +187,15 @@ async fn service_fn(SupervisorTaskState {shared, mut recv, mut shutdown}: Superv
|
|
|
|
sd_kind = &mut signal_stream => {
|
|
|
|
sd_kind = &mut signal_stream => {
|
|
|
|
// We received a signal
|
|
|
|
// We received a signal
|
|
|
|
|
|
|
|
|
|
|
|
return Err(ServiceTerminationError::Signal(sd_kind));
|
|
|
|
Err(ServiceTerminationError::Signal(sd_kind))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
disp_end = &mut command_dispatch => {
|
|
|
|
disp_end = &mut command_dispatch => {
|
|
|
|
// The command dispatch exited first, the logical error is `Graceful`. But it's not really an error, so...
|
|
|
|
// The command dispatch exited first, the logical error is `Graceful`. But it's not really an error, so...
|
|
|
|
|
|
|
|
disp_end.into()
|
|
|
|
//TODO: Anything here?
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// The mannor in which the supervisor exited.
|
|
|
|
/// The mannor in which the supervisor exited.
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
@ -254,6 +251,15 @@ pub enum ServiceTerminationError
|
|
|
|
Interest,
|
|
|
|
Interest,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl From<TerminationKind> for Result<(), ServiceTerminationError>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fn from(from: TerminationKind) -> Self
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ServiceTerminationError::Signal(from).into_own_result()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl ServiceTerminationError
|
|
|
|
impl ServiceTerminationError
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fn into_own_result(self) -> Result<(), Self>
|
|
|
|
fn into_own_result(self) -> Result<(), Self>
|
|
|
|