-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
Fix for randomized retry interval format #624
Conversation
Hi @guewen, |
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.
Thanks for your contrib!
I guess it failed because we didn't have specific tests, right?
Any chance you add that? If you don't have time that's fine, but it's a really nice to have if you can 😉
Also, could you please rewrite the commit msg to something like:
queue_job: fix retry format with tuple values
#348 added support for randomized retry intervals.
I could not set randomized retry intervals due to the formatting checks not being updated. This should fix it.
What changes:
- includes module name
- includes the full description of the issue
I will add test coverage for that case and change the commit message. |
c36faf2
to
193e5fc
Compare
OCA#348 added support for randomized retry intervals. Configuration of randomized retry intervals is not possible due to the formatting checks not being updated. This should fix it.
193e5fc
to
9b7f427
Compare
Added some simple tests that should cover the changes in |
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.
Minor remark get a more clear exception. Pre-approving
except ValueError: | ||
raise exceptions.UserError( | ||
record._retry_pattern_format_error_message() | ||
) | ||
|
||
def _retry_value_type_check(self, value): | ||
if isinstance(value, (tuple, list)): | ||
if len(value) != 2: | ||
raise ValueError | ||
[self._retry_value_type_check(element) for element in value] | ||
return | ||
int(value) |
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.
except ValueError: | |
raise exceptions.UserError( | |
record._retry_pattern_format_error_message() | |
) | |
def _retry_value_type_check(self, value): | |
if isinstance(value, (tuple, list)): | |
if len(value) != 2: | |
raise ValueError | |
[self._retry_value_type_check(element) for element in value] | |
return | |
int(value) | |
except ValueError as exc: | |
raise exceptions.UserError( | |
record._retry_pattern_format_error_message() | |
) from exc | |
def _retry_value_type_check(self, value): | |
if isinstance(value, (tuple, list)): | |
if len(value) != 2: | |
raise ValueError("Random retry pattern must be a tuple with 2 digits") | |
[self._retry_value_type_check(element) for element in value] | |
return | |
int(value) |
This PR has the |
@simahawk Is this good to merge? |
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at cf35a44. Thanks a lot for contributing to OCA. ❤️ |
queue_job: fix retry format with tuple values
#348 added support for randomized retry intervals.
I could not set randomized retry intervals due to the formatting checks not being updated. This should fix it.