mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 18:38:13 +08:00
Adds django cache as monitor cache
Not the best solution yet, but it solves monitoring problems with brokers that don't have a pattern getter for cluster stats.
This commit is contained in:
+3
-3
@@ -64,7 +64,7 @@ class Stat(Status):
|
||||
|
||||
def save(self):
|
||||
try:
|
||||
self.broker.set(self.key, signing.SignedPackage.dumps(self, True), 3)
|
||||
self.broker.set_stat(self.key, signing.SignedPackage.dumps(self, True), 3)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
@@ -78,7 +78,7 @@ class Stat(Status):
|
||||
:param cluster_id: id of the cluster
|
||||
:return: Stat or Status
|
||||
"""
|
||||
pack = broker.get(Stat.get_key(cluster_id))
|
||||
pack = broker.get_stat(Stat.get_key(cluster_id))
|
||||
if pack:
|
||||
try:
|
||||
return signing.SignedPackage.loads(pack)
|
||||
@@ -94,7 +94,7 @@ class Stat(Status):
|
||||
:return: list of type Stat
|
||||
"""
|
||||
stats = []
|
||||
packs = broker.get_pattern('{}:*'.format(Conf.Q_STAT)) or []
|
||||
packs = broker.get_stats('{}:*'.format(Conf.Q_STAT)) or []
|
||||
for pack in packs:
|
||||
try:
|
||||
stats.append(signing.SignedPackage.loads(pack))
|
||||
|
||||
Reference in New Issue
Block a user