Removed duplicate on test messages

This commit is contained in:
AnthorNet 2015-06-08 12:37:30 +02:00
parent ac92ae7076
commit 424469b9ff

View File

@ -5,6 +5,8 @@ from threading import Lock, Thread
from time import sleep from time import sleep
import hashlib import hashlib
import zlib import zlib
import re
import simplejson import simplejson
from eddn.conf.Settings import Settings, loadConfig from eddn.conf.Settings import Settings, loadConfig
@ -35,6 +37,10 @@ class DuplicateMessages(Thread):
message = zlib.decompress(message) message = zlib.decompress(message)
message = simplejson.loads(message) message = simplejson.loads(message)
# Test messages are not duplicate
if re.search('test', message['$schemaRef'], re.I):
return False
if message['header']['gatewayTimestamp']: if message['header']['gatewayTimestamp']:
del message['header']['gatewayTimestamp'] # Prevent dupe with new timestamp ^^ del message['header']['gatewayTimestamp'] # Prevent dupe with new timestamp ^^
if message['message']['timestamp']: if message['message']['timestamp']: