|
|
@ -49,6 +49,7 @@ impl Manager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
pub async fn with<F>(&mut self, block: F)
|
|
|
|
pub async fn with<F>(&mut self, block: F)
|
|
|
|
where F: FnOnce(MutexGuard<ManagerState>)
|
|
|
|
where F: FnOnce(MutexGuard<ManagerState>)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -59,13 +60,14 @@ impl Manager {
|
|
|
|
self.queue.push(ManagerSignal::TargetUpdate(target.to_string()));
|
|
|
|
self.queue.push(ManagerSignal::TargetUpdate(target.to_string()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
pub fn signal(&mut self, signal: ManagerSignal) {
|
|
|
|
pub fn signal(&mut self, signal: ManagerSignal) {
|
|
|
|
self.queue.push(signal);
|
|
|
|
self.queue.push(signal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn run(&mut self) {
|
|
|
|
pub async fn run(&mut self) {
|
|
|
|
while let Some(signal) = self.queue.next().await {
|
|
|
|
while let Some(signal) = self.queue.next().await {
|
|
|
|
let mut copy: Manager = self.clone();
|
|
|
|
let copy: Manager = self.clone();
|
|
|
|
task::spawn(async {
|
|
|
|
task::spawn(async {
|
|
|
|
match signal {
|
|
|
|
match signal {
|
|
|
|
TargetUpdate(target) => {
|
|
|
|
TargetUpdate(target) => {
|
|
|
@ -82,7 +84,7 @@ impl Manager {
|
|
|
|
ManagerRemote(self.queue.clone())
|
|
|
|
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 mut me = self.state.lock().await;
|
|
|
|
let tree = me.registry.get_dependency_tree(&target).await;
|
|
|
|
let tree = me.registry.get_dependency_tree(&target).await;
|
|
|
|
me.dependency_tree = tree;
|
|
|
|
me.dependency_tree = tree;
|
|
|
|