Skip to content

Commit 5897f7e

Browse files
repeats procedure to try fix error. issue 64
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
1 parent 5211ecc commit 5897f7e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ssm/ssm2.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ def _handle_msg(self, text):
319319
def _save_msg_to_queue(self, body, empaid):
320320
"""Extract message contents and add to the accept or reject queue."""
321321
extracted_msg, signer, err_msg = self._handle_msg(body)
322+
fails = 0
322323
try:
323324
# If the message is empty or the error message is not empty
324325
# then reject the message.
@@ -343,14 +344,14 @@ def _save_msg_to_queue(self, body, empaid):
343344
name = self._inq.add({'body': extracted_msg,
344345
'signer': signer,
345346
'empaid': empaid})
346-
try:
347-
log.info("Message saved to incoming queue as %s", name)
348-
except:
349-
_save_msg_to_queue(self, body, empaid)
350347

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

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

355356
def _send_msg(self, message, msgid):
356357
"""Send one message using stomppy.

0 commit comments

Comments
 (0)