-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repeated _save_msg_to_queue procedure until message can be saved. issue 64 #249
base: dev
Are you sure you want to change the base?
Changes from 6 commits
5211ecc
5897f7e
52554c6
c78cca2
643e912
4067424
4b3dce3
a70754c
7849c57
919a0f2
0ea9f5f
dd25479
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,9 +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) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Careful with adding extra whitespace. |
||
try: | ||
# If the message is empty or the error message is not empty | ||
# then reject the message. | ||
|
@@ -343,10 +345,14 @@ def _save_msg_to_queue(self, body, empaid): | |
name = self._inq.add({'body': extracted_msg, | ||
'signer': signer, | ||
'empaid': empaid}) | ||
log.info("Message saved to incoming queue as %s", name) | ||
|
||
log.info("Message saved to incoming queue as %s", name) | ||
DanielPerkins7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure that using recursion here is the right answer. A simple loop for the |
||
|
||
def _send_msg(self, message, msgid): | ||
"""Send one message using stomppy. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaring
fails
here puts it outside the scope of the method, which has lead to the Travis CI failing the unit tests.