repeated _save_msg_to_queue procedure until message can be saved. issue 64#249
Open
DanielPerkins7 wants to merge 12 commits intoapel:devfrom
Open
repeated _save_msg_to_queue procedure until message can be saved. issue 64#249DanielPerkins7 wants to merge 12 commits intoapel:devfrom
DanielPerkins7 wants to merge 12 commits intoapel:devfrom
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.
Merged
Member
|
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
tofu-rocketry
requested changes
Aug 2, 2023
ssm/ssm2.py
Outdated
|
|
||
| return message, signer, None | ||
|
|
||
| fails = 0 |
Member
There was a problem hiding this comment.
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
| log.error('Failed to read or write file: %s', error) | ||
| fails += 1 | ||
| if fails <= 3: | ||
| return _save_msg_to_queue(self, body, empaid) |
Member
There was a problem hiding this comment.
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) | ||
|
|
Member
There was a problem hiding this comment.
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?
rowan04
reviewed
Aug 3, 2023
Co-authored-by: Rowan <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.