Update daemon restart policy defaults to line up better with the new supervisor defaults
This commit is contained in:
parent
25e75324cf
commit
6f8fb014f2
|
@ -2,7 +2,7 @@
|
||||||
ProcessDir´³orµµ±present´³dict·³dir´³named³dir´³atom³String„„„„„µ±invalid´³dict·³dir´³named³dir³any„„„„µ±absent´³dict·„„„„„³
|
ProcessDir´³orµµ±present´³dict·³dir´³named³dir´³atom³String„„„„„µ±invalid´³dict·³dir´³named³dir³any„„„„µ±absent´³dict·„„„„„³
|
||||||
ProcessEnv´³orµµ±present´³dict·³env´³named³env´³dictof´³refµ„³EnvVariable„´³refµ„³EnvValue„„„„„„µ±invalid´³dict·³env´³named³env³any„„„„µ±absent´³dict·„„„„„³CommandLine´³orµµ±shell´³atom³String„„µ±full´³refµ„³FullCommandLine„„„„³EnvVariable´³orµµ±string´³atom³String„„µ±symbol´³atom³Symbol„„µ±invalid³any„„„³FullProcess´³andµ´³dict·³argv´³named³argv´³refµ„³CommandLine„„„„´³named³env´³refµ„³
|
ProcessEnv´³orµµ±present´³dict·³env´³named³env´³dictof´³refµ„³EnvVariable„´³refµ„³EnvValue„„„„„„µ±invalid´³dict·³env´³named³env³any„„„„µ±absent´³dict·„„„„„³CommandLine´³orµµ±shell´³atom³String„„µ±full´³refµ„³FullCommandLine„„„„³EnvVariable´³orµµ±string´³atom³String„„µ±symbol´³atom³Symbol„„µ±invalid³any„„„³FullProcess´³andµ´³dict·³argv´³named³argv´³refµ„³CommandLine„„„„´³named³env´³refµ„³
|
||||||
ProcessEnv„„´³named³dir´³refµ„³
|
ProcessEnv„„´³named³dir´³refµ„³
|
||||||
ProcessDir„„´³named³clearEnv´³refµ„³ClearEnv„„„„³ReadyOnStart´³orµµ±present´³dict·³readyOnStart´³named³readyOnStart´³atom³Boolean„„„„„µ±invalid´³dict·³readyOnStart´³named³readyOnStart³any„„„„µ±absent´³dict·„„„„„³RestartField´³orµµ±present´³dict·³restart´³named³restart´³refµ„³
RestartPolicy„„„„„µ±invalid´³dict·³restart´³named³restart³any„„„„µ±absent´³dict·„„„„„³
DaemonProcess´³rec´³lit³daemon„´³tupleµ´³named³id³any„´³named³config´³refµ„³DaemonProcessSpec„„„„„³
DaemonService´³rec´³lit³daemon„´³tupleµ´³named³id³any„„„„³
ProtocolField´³orµµ±present´³dict·³protocol´³named³protocol´³refµ„³Protocol„„„„„µ±invalid´³dict·³protocol´³named³protocol³any„„„„µ±absent´³dict·„„„„„³
RestartPolicy´³orµµ±always´³lit³always„„µ±onError´³lit³on-error„„µ±all´³lit³all„„„„³FullCommandLine´³tuplePrefixµ´³named³program´³atom³String„„„´³named³args´³seqof´³atom³String„„„„³DaemonProcessSpec´³orµµ±simple´³refµ„³CommandLine„„µ±full´³refµ„³FullDaemonProcess„„„„³FullDaemonProcess´³andµ´³named³process´³refµ„³FullProcess„„´³named³readyOnStart´³refµ„³ReadyOnStart„„´³named³restart´³refµ„³RestartField„„´³named³protocol´³refµ„³
ProtocolField„„„„„³embeddedType´³refµ³ EntityRef„³Cap„„„µ³internalServices„´³schema·³version‘³definitions·³ ConfigEnv´³dictof´³atom³Symbol„³any„³ Milestone´³rec´³lit³ milestone„´³tupleµ´³named³name³any„„„„³DebtReporter´³rec´³lit³
debt-reporter„´³tupleµ´³named³intervalSeconds´³atom³Double„„„„„³
ConfigWatcher´³rec´³lit³config-watcher„´³tupleµ´³named³path´³atom³String„„´³named³env´³refµ„³ ConfigEnv„„„„„³TcpRelayListener´³rec´³lit³relay-listener„´³tupleµ´³named³addr´³refµ³TransportAddress„³Tcp„„´³named³
|
ProcessDir„„´³named³clearEnv´³refµ„³ClearEnv„„„„³ReadyOnStart´³orµµ±present´³dict·³readyOnStart´³named³readyOnStart´³atom³Boolean„„„„„µ±invalid´³dict·³readyOnStart´³named³readyOnStart³any„„„„µ±absent´³dict·„„„„„³RestartField´³orµµ±present´³dict·³restart´³named³restart´³refµ„³
RestartPolicy„„„„„µ±invalid´³dict·³restart´³named³restart³any„„„„µ±absent´³dict·„„„„„³
DaemonProcess´³rec´³lit³daemon„´³tupleµ´³named³id³any„´³named³config´³refµ„³DaemonProcessSpec„„„„„³
DaemonService´³rec´³lit³daemon„´³tupleµ´³named³id³any„„„„³
ProtocolField´³orµµ±present´³dict·³protocol´³named³protocol´³refµ„³Protocol„„„„„µ±invalid´³dict·³protocol´³named³protocol³any„„„„µ±absent´³dict·„„„„„³
RestartPolicy´³orµµ±always´³lit³always„„µ±onError´³lit³on-error„„µ±all´³lit³all„„„„³FullCommandLine´³tuplePrefixµ´³named³program´³atom³String„„„´³named³args´³seqof´³atom³String„„„„³DaemonProcessSpec´³orµµ±simple´³refµ„³CommandLine„„µ±oneShot´³rec´³lit³one-shot„´³tupleµ´³named³setup´³refµ„³CommandLine„„„„„„µ±full´³refµ„³FullDaemonProcess„„„„³FullDaemonProcess´³andµ´³named³process´³refµ„³FullProcess„„´³named³readyOnStart´³refµ„³ReadyOnStart„„´³named³restart´³refµ„³RestartField„„´³named³protocol´³refµ„³
ProtocolField„„„„„³embeddedType´³refµ³ EntityRef„³Cap„„„µ³internalServices„´³schema·³version‘³definitions·³ ConfigEnv´³dictof´³atom³Symbol„³any„³ Milestone´³rec´³lit³ milestone„´³tupleµ´³named³name³any„„„„³DebtReporter´³rec´³lit³
debt-reporter„´³tupleµ´³named³intervalSeconds´³atom³Double„„„„„³
ConfigWatcher´³rec´³lit³config-watcher„´³tupleµ´³named³path´³atom³String„„´³named³env´³refµ„³ ConfigEnv„„„„„³TcpRelayListener´³rec´³lit³relay-listener„´³tupleµ´³named³addr´³refµ³TransportAddress„³Tcp„„´³named³
|
||||||
gatekeeper´³embedded´³refµ³
|
gatekeeper´³embedded´³refµ³
|
||||||
gatekeeper„³Resolve„„„„„„³UnixRelayListener´³rec´³lit³relay-listener„´³tupleµ´³named³addr´³refµ³TransportAddress„³Unix„„´³named³
|
gatekeeper„³Resolve„„„„„„³UnixRelayListener´³rec´³lit³relay-listener„´³tupleµ´³named³addr´³refµ³TransportAddress„³Unix„„´³named³
|
||||||
gatekeeper´³embedded´³refµ³
|
gatekeeper´³embedded´³refµ³
|
||||||
|
|
|
@ -6,7 +6,7 @@ Service = DaemonService .
|
||||||
DaemonService = <daemon @id any> .
|
DaemonService = <daemon @id any> .
|
||||||
DaemonProcess = <daemon @id any @config DaemonProcessSpec>.
|
DaemonProcess = <daemon @id any @config DaemonProcessSpec>.
|
||||||
|
|
||||||
DaemonProcessSpec = @simple CommandLine / @full FullDaemonProcess .
|
DaemonProcessSpec = @simple CommandLine / @oneShot <one-shot @setup CommandLine> / @full FullDaemonProcess .
|
||||||
FullDaemonProcess = @process FullProcess & @readyOnStart ReadyOnStart & @restart RestartField & @protocol ProtocolField .
|
FullDaemonProcess = @process FullProcess & @readyOnStart ReadyOnStart & @restart RestartField & @protocol ProtocolField .
|
||||||
ReadyOnStart = @present { readyOnStart: bool } / @invalid { readyOnStart: any } / @absent {} .
|
ReadyOnStart = @present { readyOnStart: bool } / @invalid { readyOnStart: any } / @absent {} .
|
||||||
RestartField = @present { restart: RestartPolicy } / @invalid { restart: any } / @absent {} .
|
RestartField = @present { restart: RestartPolicy } / @invalid { restart: any } / @absent {} .
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub fn on_demand(t: &mut Activation, config_ds: Arc<Cap>, root_ds: Arc<Cap>) {
|
||||||
Supervisor::start(
|
Supervisor::start(
|
||||||
t,
|
t,
|
||||||
syndicate::name!(parent: None, "daemon", id = ?spec.id),
|
syndicate::name!(parent: None, "daemon", id = ?spec.id),
|
||||||
SupervisorConfiguration::default(),
|
SupervisorConfiguration::on_error_only(),
|
||||||
enclose!((config_ds, spec) lifecycle::updater(config_ds, spec)),
|
enclose!((config_ds, spec) lifecycle::updater(config_ds, spec)),
|
||||||
enclose!((config_ds, root_ds) move |t|
|
enclose!((config_ds, root_ds) move |t|
|
||||||
enclose!((config_ds, root_ds, spec) run(t, config_ds, root_ds, spec))))
|
enclose!((config_ds, root_ds, spec) run(t, config_ds, root_ds, spec))))
|
||||||
|
@ -114,6 +114,12 @@ impl DaemonProcessSpec {
|
||||||
restart: RestartField::Absent,
|
restart: RestartField::Absent,
|
||||||
protocol: ProtocolField::Absent,
|
protocol: ProtocolField::Absent,
|
||||||
},
|
},
|
||||||
|
DaemonProcessSpec::OneShot { setup } => FullDaemonProcess {
|
||||||
|
process: Process::Simple(setup).elaborate(),
|
||||||
|
ready_on_start: ReadyOnStart::Absent,
|
||||||
|
restart: RestartField::Present { restart: Box::new(RestartPolicy::OnError) },
|
||||||
|
protocol: ProtocolField::Absent,
|
||||||
|
},
|
||||||
DaemonProcessSpec::Full(spec) => *spec,
|
DaemonProcessSpec::Full(spec) => *spec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,7 +385,7 @@ fn run(
|
||||||
};
|
};
|
||||||
let restart_policy = match config.restart {
|
let restart_policy = match config.restart {
|
||||||
RestartField::Present { restart } => *restart,
|
RestartField::Present { restart } => *restart,
|
||||||
RestartField::Absent => RestartPolicy::All,
|
RestartField::Absent => RestartPolicy::Always,
|
||||||
RestartField::Invalid { restart } => {
|
RestartField::Invalid { restart } => {
|
||||||
tracing::error!(?restart, "Invalid restart value");
|
tracing::error!(?restart, "Invalid restart value");
|
||||||
Err("Invalid restart value")?
|
Err("Invalid restart value")?
|
||||||
|
|
|
@ -66,6 +66,15 @@ impl Default for SupervisorConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SupervisorConfiguration {
|
||||||
|
pub fn on_error_only() -> Self {
|
||||||
|
Self {
|
||||||
|
restart_policy: RestartPolicy::OnErrorOnly,
|
||||||
|
.. Self::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Entity<Protocol> for Supervisor
|
impl Entity<Protocol> for Supervisor
|
||||||
{
|
{
|
||||||
fn assert(&mut self, t: &mut Activation, m: Protocol, _h: Handle) -> ActorResult {
|
fn assert(&mut self, t: &mut Activation, m: Protocol, _h: Handle) -> ActorResult {
|
||||||
|
|
Loading…
Reference in New Issue