service monitor updates, fixing a bug when max_connections is erroneously returned as zero

This commit is contained in:
KeyserSosa
2009-04-27 12:07:56 -07:00
parent 1d05efe34b
commit 2a280ede39
2 changed files with 4 additions and 2 deletions

View File

@@ -298,6 +298,8 @@ def get_read_table(tables):
#prune high-connection machines
if conns < .9 * max_conns:
candidates.append((ip, max(load, avg_load)))
else:
all_ips.append(ip)
#add the least loaded machine to all_ips
if candidates:

View File

@@ -236,12 +236,12 @@ class Database(object):
return datetime.utcnow() - update if update else None
def track(self, conn = 0, ip_conn = {}, db_conn = {}, vacuums = {},
query_count = None, max_connections = None,
query_count = None, max_connections = -1,
failures = [], disk_usage = 0):
#log the number of connections
self.connections.add(conn)
if self.max_connections:
if max_connections and max_connections > 0:
self.max_connections = max_connections
# log usage by ip