mirror of
https://github.com/EDCD/EDDN.git
synced 2026-11-20 01:42:25 +03:00
Gateway -> Monitor now working
We literally weren't making use of the 'topic' in the message. Thus, so as to avoid issues with trying to mash a string topic together with a bytes (compressed) message, I've ripped that out.
This commit is contained in:
2 files changed
+3
-16
No files matched your search
+2
-4
@@ -135,11 +135,9 @@ def push_message(parsed_message: Dict, topic: str) -> None:
|
||||
|
||||
# Push a zlib compressed JSON representation of the message to
|
||||
# announcers with schema as topic
|
||||
compressed_msg = zlib.compress(string_message)
|
||||
compressed_message = zlib.compress(string_message)
|
||||
|
||||
send_message = f"{str(topic)!r} |-| {compressed_msg!r}".encode('utf8')
|
||||
|
||||
sender.send(send_message)
|
||||
sender.send(compressed_message)
|
||||
stats_collector.tally("outbound")
|
||||
|
||||
|
||||
|
||||
+1
-12
@@ -210,23 +210,12 @@ class Monitor(Thread):
|
||||
database=Settings.MONITOR_DB['database']
|
||||
)
|
||||
|
||||
# Separate topic from message
|
||||
message_split = message.split(b' |-| ')
|
||||
|
||||
# Handle gateway not sending topic
|
||||
if len(message_split) > 1:
|
||||
message = message_split[1]
|
||||
else:
|
||||
message = message_split[0]
|
||||
|
||||
print(f'message: {message}')
|
||||
message_text = zlib.decompress(message)
|
||||
json = simplejson.loads(message_text)
|
||||
|
||||
# Default variables
|
||||
schema_id = json['$schemaRef']
|
||||
software_id = json['header']['softwareName'].encode('utf8') + ' | ' \
|
||||
+ json['header']['softwareVersion'].encode('utf8')
|
||||
software_id = f'{json["header"]["softwareName"]} | {json["header"]["softwareVersion"]}'
|
||||
|
||||
# Duplicates?
|
||||
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
||||
|
||||
Reference in new issue
Block a user