Skip to content

Commit

Permalink
procedure repeated
Browse files Browse the repository at this point in the history
resolve apel#64  .  repeats the procedure either until it works or until it has been repeated three times
  • Loading branch information
DanielPerkins7 committed Aug 2, 2023
1 parent 643e912 commit 4067424
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ssm/ssm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,11 @@ def _handle_msg(self, text):

return message, signer, None

fails = 0
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 Down Expand Up @@ -350,7 +351,7 @@ def _save_msg_to_queue(self, body, empaid):
except (IOError, OSError) as error:
log.error('Failed to read or write file: %s', error)
fails += 1
if fails < 3:
if fails <= 3:
return _save_msg_to_queue(self, body, empaid)

def _send_msg(self, message, msgid):
Expand Down

0 comments on commit 4067424

Please sign in to comment.