I suspect you're looking for stash(), which is the usual answer to "I want to pause my inbox for a bit"...
On Thu, Mar 23, 2017 at 8:47 PM, Sean Callahan <[email protected]> wrote: > Hey all. Ive got an Actor set up that when called, takes a little bit of > time to run and I want to limit how many "runs" happen at the same time. I > have a routing pool above this actor to accomplish that. However, in my > current implementation of the actor I am blocking to get that > functionality, and I definitely dont want to lose that thread to a blocking > call. > > If I use Future.pipeTo(sender()), the actor than pulls from the mailbox > almost immediately causing more work to be run that I would like. Im > guessing I am either missing something simple, or there is a better pattern > out there to solve this problem? > > class ArchiveActor (workerClass: Worker) extends Actor with Logging { > > import context.dispatcher > > private def run(minute: DateTime): Future[ArchiveResult] = { > // work is done here that returns a future > workerClass.doWork(minute) > } > > override def receive: Receive = { > case Run(minute) => > sender().tell(Await.result(run(minute), Duration.Inf), > context.parent) > } > > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/ > current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
