<DIV>Well, we're in the process of doing your third item, at least--making it two-phase.</DIV>
<DIV> </DIV>
<DIV>Bill<BR><BR><B><I>Bob Ippolito <bob@redivi.com></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">In my heapq implementation of a similar timer mechanism (outside of <BR>Twisted), I did three things that twisted doesn't:<BR>- cancelling a timer doesn't try and remove it from the heapq, instead <BR>it just marks the timer as dead.<BR>- the time when it's supposed to fire is passed to the fire method so <BR>that the timer can determine whether it's supposed to actually fire or <BR>not (in the case of a time change it is actually added to the queue a <BR>second time without being removed so that I don't have to disrupt the <BR>heapq).<BR>- it's two phase.. I have a list of newly added timers, and a heapq of <BR>waiting-to-fire timers. At the end of the iteration I shove the list <BR>into the heapq and clear the list. This prevents infinite callLater(0, <BR>...) situations.<BR><BR>-bob<BR><BR></BLOCKQUOTE><p><font face=arial size=-1>
<a href="http://in.rd.yahoo.com/specials/mailtg/*http://yahoo.shaadi.com/india-matrimony/" target="_blank">
<b>Yahoo! India Matrimony</a>:</b> Find your partner
<a href="http://in.rd.yahoo.com/specials/mailtg2/*http://yahoo.shaadi.com/india-matrimony/community.php" target="_blank">online</a>.</font>