[Twisted-Python] patch for background processing (delay 0)
bob at redivi.com
Wed May 19 01:10:58 EDT 2004
In my heapq implementation of a similar timer mechanism (outside of
Twisted), I did three things that twisted doesn't:
- cancelling a timer doesn't try and remove it from the heapq, instead
it just marks the timer as dead.
- the time when it's supposed to fire is passed to the fire method so
that the timer can determine whether it's supposed to actually fire or
not (in the case of a time change it is actually added to the queue a
second time without being removed so that I don't have to disrupt the
- it's two phase.. I have a list of newly added timers, and a heapq of
waiting-to-fire timers. At the end of the iteration I shove the list
into the heapq and clear the list. This prevents infinite callLater(0,
On May 19, 2004, at 12:53 AM, Bill la Forge wrote:
> You're quite welcome. I just hope it passes the regression tests!
> I did manage, finally, to download cygwin. (Been a few years since I've
> used it.) Here in India, bandwidth depends on a lot more than the
> connection. ;-) (Though things have improved greatly in the last few
> As for speed, I still suspect that heapq may be faster than insort. I
> there's a few places in the code base where the last element is
> inspected (timeout method comes to mind) that would need to be
> changed to the first element.
> And, of course, Heapq is mising the remove method (I've since coded
> But then there's the resetter method... might be impacted and I can't
> figure it out. ;-(
> Jp Calderone <exarkun at divmod.com> wrote:
> Thanks for the contribution :) By the way, for a slightly less hefty
> download than cygwin, check out http://unxutils.sourceforge.net/
> pointed out by bear in #twisted). It includes a Windows-native diff
> Bill la Forge
> Yahoo! India Matrimony: Find your partner online.
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2357 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040519/48f4342f/attachment.bin
More information about the Twisted-Python