Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- CLI modified
- Dependencies structure modified
- Test system modified
- `_attempt_with_retries` function modified
## [0.8] - 2026-02-05
### Added
- Support [wtfismyip.com](https://wtfismyip.com/json) IPv6 API
Expand Down
10 changes: 7 additions & 3 deletions ipspot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ def _attempt_with_retries(
next_delay = retry_delay
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

Comment on lines 92 to +101

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Because it's max_retries, not max_attempts.

total attempts = first attempt + max_retries

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense now

return result


Expand Down
Loading