Skip to content

Commit

Permalink
Merge pull request #326 from NASA-AMMOS/issue-325
Browse files Browse the repository at this point in the history
Issue #325 - Fix 0MQ data format update issues
  • Loading branch information
MJJoyce authored Mar 12, 2021
2 parents e00e1cd + 442f168 commit 48478b0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ait/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def send (self, command, *args, **kwargs):
elif self._pub_socket:
values = (self._pub_topic, str(cmdobj))
log.command('Sending via publisher: %s %s' % values)
msg = server_utils.encode_message(self._pub_topic, encoded)
msg = serv_utils.encode_message(self._pub_topic, encoded)

if msg is None:
log.error(
Expand All @@ -218,7 +218,7 @@ def send (self, command, *args, **kwargs):
self._pub_socket.send_multipart(msg)
status = True

## Only add to history file is success status is True
# Only add to history file if success status is True
if status:
with pcap.open(self.CMD_HIST_FILE, 'a') as output:
output.write(str(cmdobj))
Expand Down Expand Up @@ -582,8 +582,10 @@ def _run(self):
try:
while True:
gevent.sleep(0)
msg = self.sub.recv_multipart()
msg = self._sub.recv_multipart()
topic, message = serv_utils.decode_message(msg)
message = pickle.loads(message)

if topic is None or message is None:
log.error(f"{self} received invalid topic or message. Skipping")
continue
Expand Down

0 comments on commit 48478b0

Please sign in to comment.