Skip to content

Commit

Permalink
repeats procedure to try fix error. issue 64
Browse files Browse the repository at this point in the history
resolve apel#64. i have just repeated the procedure either until it works or until a new counter i introduced reaches 3 so there is a limit to the recursion
  • Loading branch information
DanielPerkins7 committed Aug 2, 2023
1 parent 5211ecc commit 5897f7e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ssm/ssm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def _handle_msg(self, text):
def _save_msg_to_queue(self, body, empaid):
"""Extract message contents and add to the accept or reject queue."""
extracted_msg, signer, err_msg = self._handle_msg(body)
fails = 0
try:
# If the message is empty or the error message is not empty
# then reject the message.
Expand All @@ -343,14 +344,14 @@ def _save_msg_to_queue(self, body, empaid):
name = self._inq.add({'body': extracted_msg,
'signer': signer,
'empaid': empaid})
try:
log.info("Message saved to incoming queue as %s", name)
except:
_save_msg_to_queue(self, body, empaid)

log.info("Message saved to incoming queue as %s", name)

except (IOError, OSError) as error:
log.error('Failed to read or write file: %s', error)
fails += 1
if fails > 3:
return _save_msg_to_queue(self, body, empaid)

def _send_msg(self, message, msgid):
"""Send one message using stomppy.
Expand Down

0 comments on commit 5897f7e

Please sign in to comment.