mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 15:58:06 -05:00
service monitor updates, fixing a bug when max_connections is erroneously returned as zero
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user