fixed bug in scheduler context switch, thanks Niphlod
This commit is contained in:
1 parent
0f0a62ef7f
commit
6eea834777
2 files changed
+6
-4
No files matched your search
@@ -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
@@ -812,14 +812,16 @@ class Scheduler(MetaScheduler):
|
|||||||
ticker = all_active.find(lambda row: row.is_ticker is True).first()
|
ticker = all_active.find(lambda row: row.is_ticker is True).first()
|
||||||
not_busy = self.worker_status[0] == ACTIVE
|
not_busy = self.worker_status[0] == ACTIVE
|
||||||
if not ticker:
|
if not ticker:
|
||||||
|
#if no other tickers are around
|
||||||
if not_busy:
|
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=True)
|
||||||
db(sw.worker_name != self.worker_name).update(is_ticker=False)
|
db(sw.worker_name != self.worker_name).update(is_ticker=False)
|
||||||
logger.info("TICKER: I'm a ticker")
|
logger.info("TICKER: I'm a ticker")
|
||||||
else:
|
else:
|
||||||
#giving up, only if I'm not alone
|
#I'm busy
|
||||||
if len(all_active) > 1:
|
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)
|
db(sw.worker_name == self.worker_name).update(is_ticker=False)
|
||||||
else:
|
else:
|
||||||
not_busy = True
|
not_busy = True
|
||||||
|
|||||||
Reference in new issue
Block a user