Fix Sleeping Bug - #117
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Regarding the CI failure, it appears that one of the providers (reallyfreegeoip.org), did not function as expected. However, this issue is outside the scope of the current PR. It is suggested that API call tests and function tests be addressed separately in the future. |
| for attempt in range(max_retries + 1): | ||
| result = func(**kwargs) | ||
|
|
||
| if result["status"]: | ||
| break | ||
| time.sleep(next_delay) | ||
| next_delay *= backoff_factor | ||
| return result | ||
|
|
||
| if attempt < max_retries: | ||
| time.sleep(next_delay) | ||
| next_delay *= backoff_factor | ||
|
|
There was a problem hiding this comment.
This is a correct fix. I have a separate question:
The result = func(**kwargs) repeats max_retries + 1 times; am I right?
For attempt=0 to attempt=max_retries.
There was a problem hiding this comment.
Yes. Because it's max_retries, not max_attempts.
total attempts = first attempt + max_retries
Reference Issues/PRs
What does this implement/fix? Explain your changes.
_attempt_with_retriesfunction modifiedAny other comments?