From 1087700a2e78d08fbe2974e34d5cf48f916e9275 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Tue, 15 Oct 2013 19:51:47 +0000 Subject: [PATCH] sparse value store --- sensorvalues-to-json-zmq.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sensorvalues-to-json-zmq.py b/sensorvalues-to-json-zmq.py index fa6e7f5..d6bc31e 100755 --- a/sensorvalues-to-json-zmq.py +++ b/sensorvalues-to-json-zmq.py @@ -40,7 +40,7 @@ class UWSConfig: self.config_parser.add_section('json') self.config_parser.set('json','write_path',"/dev/shm/wget/r3sensors.json") self.config_parser.set('json','moveto_path',"/dev/shm/www/r3sensors.json") - self.config_parser.set('json','backup_path',"/home/guests/realraum.wirdorange.org/public_html/r3sensors.json.bak") + self.config_parser.set('json','backup_path',"/home/guests/realraum.wirdorange.org/r3sensors.json.bak") self.config_parser.set('json','backup_every',"50") self.config_parser.set('json','limit_list_len',"10000") self.config_parser.set('json','updateinterval',"30") @@ -228,6 +228,12 @@ def addEventsToStore(): sensor_store_[structname].insert(0,[time_column_name_] + list(map(lambda n: "Sensor %d"%n,range(0,sensor_cols_num_[structname])))) # add values + try: + # if latest values are identical, just update timestamp + if sensor_store_[structname][-1][1:] == latest_values_[structname] and sensor_store_[structname][-1][1:] == sensor_store_[structname][-2][1:]: + sensor_store_[structname].pop() + except: + pass sensor_store_[structname].append([ts] + latest_values_[structname]) #cap list lenght -- 1.7.10.4