Avoid spurious long-lived Account

This commit is contained in:
Tony Garnock-Jones 2021-08-31 16:21:00 +02:00
parent 2e232ca5b2
commit fb6070d1cd
1 changed files with 3 additions and 5 deletions

View File

@ -163,11 +163,9 @@ fn run(t: &mut Activation, ds: Arc<Cap>, captures: AnyValue) -> ActorResult {
thread::spawn(move || { thread::spawn(move || {
let mut path_state: Map<PathBuf, Set<Handle>> = Map::new(); let mut path_state: Map<PathBuf, Set<Handle>> = Map::new();
let account = Account::new(syndicate::name!("watcher"));
{ {
let root_path = path.clone().into(); let root_path = path.clone().into();
facet.activate(Arc::clone(&account), |t| { facet.activate(Account::new(syndicate::name!("initial_scan")), |t| {
initial_scan(t, &mut path_state, &ds, &root_path); initial_scan(t, &mut path_state, &ds, &root_path);
Ok(()) Ok(())
}).unwrap(); }).unwrap();
@ -175,7 +173,7 @@ fn run(t: &mut Activation, ds: Arc<Cap>, captures: AnyValue) -> ActorResult {
} }
let mut rescan = |paths: Vec<PathBuf>| { let mut rescan = |paths: Vec<PathBuf>| {
facet.activate(Arc::clone(&account), |t| { facet.activate(Account::new(syndicate::name!("rescan")), |t| {
let mut to_retract = Set::new(); let mut to_retract = Set::new();
for path in paths.into_iter() { for path in paths.into_iter() {
let maybe_handles = path_state.remove(&path); let maybe_handles = path_state.remove(&path);
@ -213,7 +211,7 @@ fn run(t: &mut Activation, ds: Arc<Cap>, captures: AnyValue) -> ActorResult {
} }
} }
let _ = facet.activate(Arc::clone(&account), |t| { let _ = facet.activate(Account::new(syndicate::name!("termination")), |t| {
tracing::trace!("linked thread terminating associated facet"); tracing::trace!("linked thread terminating associated facet");
t.stop(); t.stop();
Ok(()) Ok(())