mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-20 16:53:54 +03:00
Remove duplicate timestamp to avoid close messages to pass
This commit is contained in:
parent
193b90fcaf
commit
a54b0bd04e
@ -32,7 +32,7 @@ class DuplicateMessages(Thread):
|
|||||||
|
|
||||||
def isDuplicated(self, json):
|
def isDuplicated(self, json):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
# Test messages are not duplicate
|
# Test messages are never duplicate, would be a pain to wait for another test :D
|
||||||
if re.search('test', json['$schemaRef'], re.I):
|
if re.search('test', json['$schemaRef'], re.I):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -50,6 +50,10 @@ class DuplicateMessages(Thread):
|
|||||||
if 'DistFromStarLS' in jsonTest['message']:
|
if 'DistFromStarLS' in jsonTest['message']:
|
||||||
jsonTest['message']['DistFromStarLS'] = int(jsonTest['message']['DistFromStarLS'] + 0.5)
|
jsonTest['message']['DistFromStarLS'] = int(jsonTest['message']['DistFromStarLS'] + 0.5)
|
||||||
|
|
||||||
|
# Remove journal timestamp (Mainly to avoid multiple scan messages and faction influences)
|
||||||
|
if 'timestamp' in jsonTest['message']:
|
||||||
|
del jsonTest['message']['timestamp']
|
||||||
|
|
||||||
message = simplejson.dumps(jsonTest, sort_keys=True) # Ensure most duplicate messages will get the same key
|
message = simplejson.dumps(jsonTest, sort_keys=True) # Ensure most duplicate messages will get the same key
|
||||||
key = hashlib.sha256(message).hexdigest()
|
key = hashlib.sha256(message).hexdigest()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user