Author: eallen
Date: 2008-10-24 11:34:49 -0400 (Fri, 24 Oct 2008)
New Revision: 2681
Modified:
mgmt/trunk/cumin/python/cumin/limits.py
Log:
Implement better way of determining if there was an error receiving limits.
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-10-24 15:32:11 UTC (rev 2680)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-10-24 15:34:49 UTC (rev 2681)
@@ -20,16 +20,25 @@
def fetch_limits(self, session):
negotiator = self.get_negotiator(session)
if negotiator:
- return self.get_raw_limits(session, negotiator)
+ limits = self.get_raw_limits(session, negotiator)
+ if "timeout" in limits:
+ del limits["timeout"]
+ return limits
else:
return dict()
def get_negotiator(self, session):
#TODO: find better way to get the negotiator. from pool perhaps?
+ most_recent = None
negotiators = Negotiator.select()
for negotiator in negotiators:
if negotiator.managedBroker:
- return negotiator
+ if not most_recent:
+ most_recent = negotiator
+ if negotiator.statsCurr.recTime > most_recent.statsCurr.recTime:
+ most_recent = negotiator
+
+ return most_recent
def set_limit(self, session, limit):
negotiator = self.get_negotiator(session)