-
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?
Conversation
resolve apel#64. i was unsure which part needed to be repeated so i just repeated the whole function until the message can be saved into the queue, im not sure if this is right though.
From dev meeting:
|
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
procedure repeates either until it works or until the counter reaches three to avoid infinite recursion
resolve apel#64 . repeats the procedure either until it works or until it has been repeated three times
resolve apel#64 . repeats the procedure either until it works or until it has been repeated three times
Conflicts: ssm/ssm2.py
ssm/ssm2.py
Outdated
@@ -316,9 +316,11 @@ def _handle_msg(self, text): | |||
|
|||
return message, signer, None | |||
|
|||
fails = 0 |
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.
ssm/ssm2.py
Outdated
|
||
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 comment
The 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 add
calls would be the more straightforward solution.
ssm/ssm2.py
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Careful with adding extra whitespace.
resolve apel#64. loops the add calls until they work or until the for loop is exhausted. is something like this what you mean?
Co-authored-by: Rowan <[email protected]>
resolve #64. i was unsure which part needed to be repeated so i just repeated the whole function until the message can be saved into the queue, im not sure if this is right though.