asynchat sends data on async_chat.push and .push_with_producer

Giampaolo Rodola' gnewsg at gmail.com
Tue May 13 21:20:29 EDT 2008


On 14 Mag, 02:56, Jean-Paul Calderone <exar... at divmod.com> wrote:

> Why?  Isn't this why subtraction exists?  If there is a call scheduled to
> happen at T1 and the current time is T2, then I know that after (T1 - T2)
> elapses, it will be time to run the call.  Why do I have to do any checks
> at all?  I just tell select() to wait that long.  Presumably this is just
> what someone will do if they want to use asyncore with timed calls.  Call
> asyncore.loop() in a loop, always passing (T1 - T2) as the timeout value.

That doesn't work if I decide to schedule one or more calls AFTER the
loop has started (see: "I already told select what timeout use").
As far as I've understood by reading the Twisted core what happens is
that there's a heap of scheduled calls and a loop that keeps calling
time.time() to check the scheduled functions due to expire soonest.
I've also proposed a patch for asyncore using the same approach:
http://bugs.python.org/issue1641

> So, actually, I'm not sure what the disagreement is about. ;)  

The current disagreement is about how Twisted timed events are
implemented. :)

> On the other hand, I didn't
> this thread (or maybe just this part of the thread) start out with
> a question about asyncore throughput?  I have no idea what that
> might have to do with this.

Nothing, we just finished OT. :)


--- Giampaolo
http://code.google.com/p/pyftpdlib



More information about the Python-list mailing list