Author: tmckay
Date: 2010-11-12 14:53:20 -0500 (Fri, 12 Nov 2010)
New Revision: 4413
Modified:
mgmt/trunk/mint/python/mint/update.py
Log:
Add a forced write to the database after an interval (1 hour) for objects that are
actively sending update messages but whose values are not changing. This prevents objects
from being filtered out in the UI.
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2010-11-10 00:46:08 UTC (rev 4412)
+++ mgmt/trunk/mint/python/mint/update.py 2010-11-12 19:53:20 UTC (rev 4413)
@@ -252,6 +252,17 @@
if cls._package is self.model.org_apache_qpid_broker:
self.maybe_drop_sample(obj)
+ # We want a time stamp that shows the last time an
+ # object was written through to the database. If we see that
+ # updates are coming in, but an object is not being
+ # written through because values are the same,
+ # we want to force a write after a while. This prevents
+ # objects from being filtered out in the UI.
+
+ # Initialize our tracking timestamp here if it does not yet exist.
+ if not hasattr(obj,"_last_write_time"):
+ obj._last_write_time = obj._qmf_update_time
+
self.update_object(cursor, stats, obj)
def get_agent_id(self):
@@ -378,12 +389,16 @@
statements = list()
cls = obj._class
- if object_columns:
+ # force a write if it's been too long, even if the values match
+ if object_columns \
+ or obj._last_write_time < obj._qmf_update_time - timedelta(hours=1):
object_columns.append(cls.sql_table._qmf_update_time)
sql = cls.sql_update_object.emit(object_columns)
statements.append(sql)
+ obj._last_write_time = obj._qmf_update_time
+
if sample_columns:
sample_columns.append(cls.sql_samples_table._qmf_update_time)
Show replies by date