> Are there any good suggestions for stopping the DealWithRequestActor when
> the there is a request timeout
There are several strategies.
The simplest one would be to stop the request actor after it has completed the request.
(if your logic makes sure that this will always be the case, even if the completion happens too late).
Or you handle `Timedout` messages in your main service actor (or dedicated timeout handler) and then stop/kill the respective request actor.
This would allow you to stop an ongoing request handling process right after the timeout has happened and not waste any more resources on computing a response that will arrive to late anyway…
On 05.04.2013, at 14:09, V <
c0deatt...@gmail.com> wrote:
> Hi,
>
> I have a query about the best approach to cleaning up Akka Actors when a
> Spray Http Timeout is received.
>
> Let's say that in your Spray HttpService you have set your request-timeout
> to be 3 seconds.
> And you create a new DealWithRequestActor for each new Http Request in the
> your HttpService, passing it the RequestContext in the Actor's constructor.
> If DealWithRequestActor takes 10 seconds to process before it calls
> ctx.complete(...), Spray will have already sent the Timeout message, and it
> will close the ConnectionActor.
>
> The problems then are:
>
> - The DealWithRequestActor eventually finishes, and tries to call
> ctx.complete, but the response is completed.
> - The DealWithRequestActor will linger in the ActorSystem forever.
>
> Are there any good suggestions for stopping the DealWithRequestActor when
> the there is a request timeout?
>
> Thanks,
> V
>
>
>