From 2bfc26faf29a7a0917ca8757c72ce0f885c6856d Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sat, 27 Mar 2021 23:54:09 +0900 Subject: [PATCH] [BUG FIX]Make RemoveFetchActor subscribe to channel once --- plume-models/src/remote_fetch_actor.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plume-models/src/remote_fetch_actor.rs b/plume-models/src/remote_fetch_actor.rs index da73b077..097fb1da 100644 --- a/plume-models/src/remote_fetch_actor.rs +++ b/plume-models/src/remote_fetch_actor.rs @@ -17,24 +17,22 @@ pub struct RemoteFetchActor { impl RemoteFetchActor { pub fn init(conn: DbPool) { - ACTOR_SYS + let actor = ACTOR_SYS .actor_of_args::("remote-fetch", conn) .expect("Failed to initialize remote fetch actor"); - } -} -impl Actor for RemoteFetchActor { - type Msg = UserEvent; - - fn pre_start(&mut self, ctx: &Context) { USER_CHAN.tell( Subscribe { - actor: Box::new(ctx.myself()), + actor: Box::new(actor), topic: "*".into(), }, None, ) } +} + +impl Actor for RemoteFetchActor { + type Msg = UserEvent; fn recv(&mut self, _ctx: &Context, msg: Self::Msg, _sender: Sender) { use UserEvent::*;