Skip to content

Commit afbea3e

Browse files
sieve: ActorHandle will do (#423)
Summary: Pull Request resolved: #423 all the actors in this program run on the same proc. accordingly, use `ActorHandle`s not `ActorRef`s. Reviewed By: mariusae Differential Revision: D77740531 fbshipit-source-id: 1e8f10d648e7d6bf63c224a054f6db83d417452c
1 parent 13317f9 commit afbea3e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

hyperactor_mesh/examples/sieve.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::process::ExitCode;
1717
use anyhow::Result;
1818
use async_trait::async_trait;
1919
use hyperactor::Actor;
20-
use hyperactor::ActorRef;
20+
use hyperactor::ActorHandle;
2121
use hyperactor::Context;
2222
use hyperactor::Handler;
2323
use hyperactor::Named;
@@ -67,7 +67,7 @@ pub struct SieveActor {
6767
/// Prime used for filtering.
6868
prime: u64,
6969
/// Next actor in the sieve chain.
70-
next: Option<ActorRef<SieveActor>>,
70+
next: Option<ActorHandle<SieveActor>>,
7171
}
7272

7373
#[async_trait]
@@ -76,13 +76,12 @@ impl Handler<NextNumber> for SieveActor {
7676
if msg.number % self.prime != 0 {
7777
match &self.next {
7878
Some(next) => {
79-
next.send(this, msg)?;
79+
next.send(msg)?;
8080
}
8181
None => {
8282
msg.prime_collector.send(this, msg.number)?;
83-
let child = SieveActor::spawn(this, SieveParams { prime: msg.number }).await?;
84-
let child_ref = child.bind();
85-
self.next = Some(child_ref);
83+
self.next =
84+
Some(SieveActor::spawn(this, SieveParams { prime: msg.number }).await?);
8685
}
8786
}
8887
}

0 commit comments

Comments
 (0)