Timeout with persistent connections
Martin Parm
mp at leasingborsen.dk
Mon Jul 25 20:08:57 CEST 2011
On 07/25/11 18:19, Marc Lehmann wrote:
> On Mon, Jul 25, 2011 at 05:32:33PM +0200, Martin Parm <mp at leasingborsen.dk> wrote:
>> sleep 6;
>
> This is the problem. Basically, you stop the time for an extended period
> without telling the event loop (which still thinks it is 6 seconds past
> when new timeouts are created). Since 6 seconds is long enough for a
> timeout to occur, one does occur immediately.
>
> The solution would be to call AnyEvent->now_update after the sleep, so the
> event loop can catch up with the missed time.
Ah, that was the clue I needed. That explains why this occurs in
KiokuDB::Backend::CouchDB in our Catalyst application.
Thanks.
--
Martin Parm
LeasingBorsen.dk
More information about the anyevent
mailing list