Skip to content

Commit

Permalink
Implement code to stop send_all from clearing the message if its too …
Browse files Browse the repository at this point in the history
…large

Signed-off-by: jounaidr <[email protected]>
  • Loading branch information
jounaidr authored and tofu-rocketry committed Jun 12, 2023
1 parent 91b65a2 commit c1cd4b6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ssm/ssm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ def _send_msg_ams(self, text, msgid):
return argo_response['messageIds'][0]

else:
log.error('Message %s could not be sent as its larger than 1MB', msgid)
# Return a non AMS response so that the large message is not removed
log.warn('Message %s could not be sent as its larger than 1MB', msgid)
return "TOO LARGE"

def pull_msg_ams(self):
"""Pull 1 message from the AMS and acknowledge it."""
Expand Down Expand Up @@ -505,11 +507,12 @@ def send_all(self):
raise Ssm2Exception('Unknown messaging protocol: %s' %
self._protocol)

# log that the message was sent
log.info(log_string)
if self._protocol == Ssm2.AMS_MESSAGING and argo_id != "TOO LARGE":
# log that the message was sent
log.info(log_string)

self._last_msg = None
self._outq.remove(msgid)
self._last_msg = None
self._outq.remove(msgid)

log.info('Tidying message directory.')
try:
Expand Down

0 comments on commit c1cd4b6

Please sign in to comment.