Skip to content

Fix Sleeping Bug - #117

Merged
sadrasabouri merged 2 commits into
devfrom
fix-sleeping
Aug 29, 2026
Merged

Fix Sleeping Bug#117
sadrasabouri merged 2 commits into
devfrom
fix-sleeping

Conversation

@sepandhaghighi

Copy link
Copy Markdown
Member

Reference Issues/PRs

What does this implement/fix? Explain your changes.

  • _attempt_with_retries function modified
  • Fix unnecessary sleeping after the final retry

Any other comments?

@sepandhaghighi sepandhaghighi added this to the ipspot v0.9 milestone Aug 24, 2026
@sepandhaghighi sepandhaghighi self-assigned this Aug 24, 2026
@sepandhaghighi sepandhaghighi added the bug Something isn't working label Aug 24, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

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.

@sepandhaghighi
sepandhaghighi marked this pull request as ready for review August 27, 2026 20:59
@sepandhaghighi

Copy link
Copy Markdown
Member Author

@sadrasabouri

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.

Comment thread ipspot/utils.py
Comment on lines 92 to +101
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

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

@sadrasabouri sadrasabouri left a comment

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.

LGTM

@sadrasabouri
sadrasabouri merged commit af653c1 into dev Aug 29, 2026
24 of 25 checks passed
@sadrasabouri
sadrasabouri deleted the fix-sleeping branch August 29, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants