Handle a possible suck-100%-cpu bug if drivers._drivers contains only the schedule driver.

This commit is contained in:
Jeremy Fincher 2004-02-09 07:09:06 +00:00
parent f2bb0c0125
commit 86eb377442

View File

@ -97,6 +97,8 @@ class Schedule(drivers.IrcDriver):
removePeriodicEvent = removeEvent removePeriodicEvent = removeEvent
def run(self): def run(self):
if len(drivers._drivers) == 1:
time.sleep(1) # We're the only driver; let's pause to think.
while self.schedule and self.schedule[0][0] < time.time(): while self.schedule and self.schedule[0][0] < time.time():
(t, name) = heapq.heappop(self.schedule) (t, name) = heapq.heappop(self.schedule)
f = self.events[name] f = self.events[name]