Skip to content

Commit

Permalink
Updated children group's run to poll children before getting new mess…
Browse files Browse the repository at this point in the history
…ages and to be pending when its broadcast stream is, and fixed supervisors to update the id of supervised elements in the order list after resetting them and when using the one-for-one supervision strategy.

Signed-off-by: Matthieu Le brazidec <matthieu@lebrazidec.email>
  • Loading branch information
r3v2d0g committed Nov 7, 2019
1 parent 221172b commit c6143f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions bastion/src/children.rs
Expand Up @@ -350,6 +350,10 @@ impl Children {

async fn run(mut self) -> Self {
loop {
for (_, launched) in self.launched.values_mut() {
let _ = poll!(launched);
}

match poll!(&mut self.bcast.next()) {
// TODO: Err if started == true?
Poll::Ready(Some(BastionMessage::Start)) => {
Expand Down Expand Up @@ -382,11 +386,7 @@ impl Children {

return self;
}
Poll::Pending => (),
}

for (_, launched) in self.launched.values_mut() {
let _ = poll!(launched);
Poll::Pending => pending!(),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion bastion/src/supervisor.rs
Expand Up @@ -562,7 +562,8 @@ impl Supervisor {
}

let launched = supervised.launch();
self.launched.insert(id, (order, launched));
self.launched.insert(id.clone(), (order, launched));
self.order[order] = id;
}
SupervisionStrategy::OneForAll => {
// TODO: stop or kill?
Expand Down

0 comments on commit c6143f9

Please sign in to comment.