This commit is contained in:
parent
fb7da7cffc
commit
775040be91
3 changed files with 4 additions and 6 deletions
|
@ -5,8 +5,6 @@ use sysf::config::loader::Loader;
|
|||
use async_std::task;
|
||||
use crate::manager::{Manager, ManagerSignal};
|
||||
use std::time::Duration;
|
||||
use async_std::process::exit;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
mod manager;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ impl Manager {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn with<F>(&mut self, block: F)
|
||||
where F: FnOnce(MutexGuard<ManagerState>)
|
||||
{
|
||||
|
@ -59,13 +60,14 @@ impl Manager {
|
|||
self.queue.push(ManagerSignal::TargetUpdate(target.to_string()));
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn signal(&mut self, signal: ManagerSignal) {
|
||||
self.queue.push(signal);
|
||||
}
|
||||
|
||||
pub async fn run(&mut self) {
|
||||
while let Some(signal) = self.queue.next().await {
|
||||
let mut copy: Manager = self.clone();
|
||||
let copy: Manager = self.clone();
|
||||
task::spawn(async {
|
||||
match signal {
|
||||
TargetUpdate(target) => {
|
||||
|
@ -82,7 +84,7 @@ impl Manager {
|
|||
ManagerRemote(self.queue.clone())
|
||||
}
|
||||
|
||||
async fn update_target(mut self, target: String) {
|
||||
async fn update_target(self, target: String) {
|
||||
let mut me = self.state.lock().await;
|
||||
let tree = me.registry.get_dependency_tree(&target).await;
|
||||
me.dependency_tree = tree;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use async_std::path::Path;
|
||||
use async_std::prelude::*;
|
||||
use std::cell::Cell;
|
||||
use crate::utils::asyn::IntoResults;
|
||||
use std::io::{ErrorKind, Error};
|
||||
use async_std::fs::{read_to_string, read_dir, ReadDir, DirEntry};
|
||||
use async_std::task;
|
||||
use crate::config::Config;
|
||||
use std::collections::HashSet;
|
||||
use crate::unit::Unit;
|
||||
|
|
Loading…
Reference in a new issue