From 1068ff9bf74cf411be701bb50fae92e8476b5da7 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 20 Jan 2013 23:53:52 +0100 Subject: datastore foo --- datastore/store/controller.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'datastore/store/controller.py') diff --git a/datastore/store/controller.py b/datastore/store/controller.py index 0814488..0d694d1 100644 --- a/datastore/store/controller.py +++ b/datastore/store/controller.py @@ -1,4 +1,5 @@ import traceback +import time class SubscriptionManager: def __init__(self): @@ -56,13 +57,16 @@ class StoreController: class MQStoreController(StoreController): def cb_put(self, frame): try: + if not frame.headers.has_key("timestamp"): + frame.headers['timestamp'] = str(time.time()) assert len(frame.timestamp) > 0 values = map(lambda kv: kv.split("="), frame.body.split("\n")) + values = filter(lambda x: len(x)==2, values) #filter non-pairs from empty lines for (name,data) in values: - assert self.channels.has_key(name) + if name not in self.channels.keys(): + print "No channel named {0}".format(name) + continue print name,"=",data - - for (name,data) in values: self.put(name, frame.timestamp, data) except Exception,e: traceback.print_exc() -- cgit v1.2.1