Run poll-vars immediately when starting (fixes #98)

This commit is contained in:
elkowar 2021-01-31 16:20:19 +01:00
parent 7648a400c3
commit ebb8fc065d

View file

@ -135,6 +135,11 @@ impl PollVarHandler {
self.poll_handles.insert(var.name.clone(), cancellation_token.clone());
let evt_send = self.evt_send.clone();
tokio::spawn(async move {
let result: Result<_> = try {
evt_send.send(app::DaemonCommand::UpdateVars(vec![(var.name.clone(), var.run_once()?)]))?;
};
crate::print_result_err!("while running script-var command", &result);
crate::loop_select_exiting! {
_ = cancellation_token.cancelled() => break,
_ = tokio::time::sleep(var.interval) => {