fixed possible scheduler problem, thanks Mike Dickun and Niphlod

This commit is contained in:
mdipierro
2012-12-23 15:07:43 -06:00
parent ba0e51ad02
commit ee2c4f339a
2 changed files with 18 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.1-alpha.1+timestamp.2012.12.22.21.26.15
Version 2.4.1-alpha.1+timestamp.2012.12.23.15.06.58
+17 -3
View File
@@ -534,7 +534,7 @@ class Scheduler(MetaScheduler):
self.sleep()
continue
logger.debug('looping...')
task = self.pop_task()
task = self.wrapped_pop_task()
if task:
self.empty_runs = 0
self.worker_status[0] = RUNNING
@@ -569,9 +569,23 @@ class Scheduler(MetaScheduler):
x += 1
time.sleep(0.5)
def pop_task(self):
def wrapped_pop_task(self):
db = self.db
x = 0
while x < 10:
try:
rtn = self.pop_task(db)
return rtn
break
except:
db.rollback()
logger.error('TICKER(%s): error popping tasks', self.worker_name)
x += 1
time.sleep(0.5)
def pop_task(self, db):
now = self.now()
db, st = self.db, self.db.scheduler_task
st = self.db.scheduler_task
if self.is_a_ticker and self.do_assign_tasks:
#I'm a ticker, and 5 loops passed without reassigning tasks, let's do
#that and loop again