mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-09 13:08:11 +08:00
Removed Cluster.is_idle
It wasn't used and it could be confused with the cluster stat IDLE
This commit is contained in:
@@ -49,7 +49,6 @@ class Cluster(object):
|
|||||||
self.sentinel = None
|
self.sentinel = None
|
||||||
self.stop_event = None
|
self.stop_event = None
|
||||||
self.start_event = None
|
self.start_event = None
|
||||||
self.stopped_event = None
|
|
||||||
self.pid = current_process().pid
|
self.pid = current_process().pid
|
||||||
self.host = socket.gethostname()
|
self.host = socket.gethostname()
|
||||||
self.list_key = list_key
|
self.list_key = list_key
|
||||||
@@ -111,10 +110,6 @@ class Cluster(object):
|
|||||||
def has_stopped(self):
|
def has_stopped(self):
|
||||||
return self.start_event is None and self.stop_event is None and self.sentinel
|
return self.start_event is None and self.stop_event is None and self.sentinel
|
||||||
|
|
||||||
@property
|
|
||||||
def is_idle(self):
|
|
||||||
return self.sentinel is None
|
|
||||||
|
|
||||||
|
|
||||||
class Sentinel(object):
|
class Sentinel(object):
|
||||||
def __init__(self, stop_event, start_event, list_key=Conf.Q_LIST, timeout=Conf.TIMEOUT, start=True):
|
def __init__(self, stop_event, start_event, list_key=Conf.Q_LIST, timeout=Conf.TIMEOUT, start=True):
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ def test_cluster_initial(r):
|
|||||||
r.delete(list_key)
|
r.delete(list_key)
|
||||||
c = Cluster(list_key=list_key)
|
c = Cluster(list_key=list_key)
|
||||||
assert c.sentinel is None
|
assert c.sentinel is None
|
||||||
assert c.is_idle
|
|
||||||
assert c.start() > 0
|
assert c.start() > 0
|
||||||
assert c.sentinel.is_alive() is True
|
assert c.sentinel.is_alive() is True
|
||||||
assert c.is_running
|
assert c.is_running
|
||||||
|
|||||||
Reference in New Issue
Block a user