--- other/Twisted/Twisted-1.2.0/twisted/internet/base.py 2004-02-03 02:51:32.000000000 +0530 +++ Python23/Lib/site-packages/twisted/internet/base.py 2004-05-19 11:34:46.081104000 +0530 @@ -365,10 +365,16 @@ assert callable(_f), "%s is not callable" % _f assert sys.maxint >= _seconds >= 0, \ "%s is not greater than or equal to 0 seconds" % (_seconds,) - tple = DelayedCall(seconds() + _seconds, _f, args, kw, - self._pendingTimedCalls.remove, - self._resetCallLater) - insort(self._pendingTimedCalls, tple) + if _seconds != 0: + tple = DelayedCall(_seconds + seconds(), _f, args, kw, + self._pendingTimedCalls.remove, + self._resetCallLater) + insort(self._pendingTimedCalls, tple) + else: + tple = DelayedCall(0, _f, args, kw, + self._pendingTimedCalls.remove, + self._resetCallLater) + self._pendingTimedCalls.append(tple) return tple def _resetCallLater(self, tple): @@ -412,9 +418,14 @@ log.err() count += 1 del self.threadCallQueue[:count] + if not self._pendingTimedCalls: + return now = seconds() + do=[] while self._pendingTimedCalls and (self._pendingTimedCalls[-1].time <= now): - call = self._pendingTimedCalls.pop() + do.append(self._pendingTimedCalls.pop()) + for call in do: + try: call.called = 1 call.func(*call.args, **call.kw)