mongo importer changes

This commit is contained in:
Wolfgang Hottgenroth 2017-11-14 20:02:36 +01:00
parent cdd1ae56e2
commit e97e46cf3f
3 changed files with 10 additions and 8 deletions

View File

@ -17,14 +17,15 @@ DEBUG = True
DEBUG_TO_STDOUT = True
DATABASE_CONFIG = {
'period':60,
'host':'localhost',
'period':1,
'host':'172.16.2.17',
'user':'smarthome',
'password':'smarthome123',
'db':'smarthome'
'db':'testhome'
}
QUEUE_CONFIG = {
'file':'/tmp/mqttDispatcherQueue'
'file':'/tmp/mqttDispatcherQueue',
'maxsize':1000
}
Logger.openlog(LOG_FILE)

View File

@ -51,7 +51,8 @@ DATABASE_CONFIG = {
#}
QUEUE_CONFIG = {
'file':'/tmp/mqttDispatcherQueue'
'file':'/tmp/mqttDispatcherQueue',
'maxsize':0
}
if BACKGROUND:

View File

@ -4,11 +4,11 @@ from persistqueue import Queue
class PersistentQueue(object):
def __init__(self, config):
super(PersistentQueue, self).__init__()
self.queue = Queue(config['file'])
self.queue = Queue(config['file'], config['maxsize'])
def execute(self, data):
Logger.log("PersistentQueue %s" % (str(data)))
self.queue.put_nowait(data)
self.queue.put(data)
def empty(self):
return not self.queue.qsize()