Run poll-vars immediately when starting (fixes #98)
This commit is contained in:
parent
7648a400c3
commit
ebb8fc065d
1 changed files with 5 additions and 0 deletions
|
@ -135,6 +135,11 @@ impl PollVarHandler {
|
||||||
self.poll_handles.insert(var.name.clone(), cancellation_token.clone());
|
self.poll_handles.insert(var.name.clone(), cancellation_token.clone());
|
||||||
let evt_send = self.evt_send.clone();
|
let evt_send = self.evt_send.clone();
|
||||||
tokio::spawn(async move {
|
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! {
|
crate::loop_select_exiting! {
|
||||||
_ = cancellation_token.cancelled() => break,
|
_ = cancellation_token.cancelled() => break,
|
||||||
_ = tokio::time::sleep(var.interval) => {
|
_ = tokio::time::sleep(var.interval) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue