fixed bug in scheduler context switch, thanks Niphlod

This commit is contained in:
Massimo
2013-04-05 16:01:13 -05:00
parent 0f0a62ef7f
commit 6eea834777
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.5-stable+timestamp.2013.04.04.21.10.38
Version 2.4.5-stable+timestamp.2013.04.05.15.59.29
+5 -3
View File
@@ -812,14 +812,16 @@ class Scheduler(MetaScheduler):
ticker = all_active.find(lambda row: row.is_ticker is True).first()
not_busy = self.worker_status[0] == ACTIVE
if not ticker:
#if no other tickers are around
if not_busy:
#only if this worker isn't busy, otherwise wait for a free one
#only if I'm not busy
db(sw.worker_name == self.worker_name).update(is_ticker=True)
db(sw.worker_name != self.worker_name).update(is_ticker=False)
logger.info("TICKER: I'm a ticker")
else:
#giving up, only if I'm not alone
if len(all_active) > 1:
#I'm busy
if len(all_active) >= 1:
#so I'll "downgrade" myself to a "poor worker"
db(sw.worker_name == self.worker_name).update(is_ticker=False)
else:
not_busy = True