diff --git a/VERSION b/VERSION index e75b1664..89192c6b 100644 --- a/VERSION +++ b/VERSION @@ -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 diff --git a/gluon/scheduler.py b/gluon/scheduler.py index c9472da4..57a2937a 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -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