Skip to content

fix: allow max_retries=0 to disable retries - #1142

Merged
vdusek merged 3 commits into
masterfrom
fix/max-retries-zero
Oct 16, 2026
Merged

vdusek merged 3 commits into
masterfrom
fix/max-retries-zero

Conversation

@vdusek

@vdusek vdusek commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

max_retries counts retries, so 0 should mean a single attempt. Instead, every request with max_retries=0 raised ValueError from the retry loop. Now 0 disables retries, and a negative value raises ValueError when ApifyClient, ApifyClientAsync or an HTTP client is constructed.

This is a regression from 3.0.0. Up to 2.5.1, max_retries=0 made exactly one attempt; the ValueError check came in with #604. The JS client also accepts 0.

The tests in test_client_errors.py that meant to avoid retries used max_retries=1, which still retries once. They now use 0.

Closes: #1139

✍️ Drafted by Claude Code

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 16, 2026
@vdusek vdusek self-assigned this Oct 16, 2026
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.50%. Comparing base (53a9954) to head (7f1153a).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1142      +/-   ##
==========================================
+ Coverage   95.43%   95.50%   +0.06%     
==========================================
  Files          61       61              
  Lines        5935     5937       +2     
==========================================
+ Hits         5664     5670       +6     
+ Misses        271      267       -4     
Flag Coverage Δ
integration 90.76% <50.00%> (-0.04%) ⬇️
unit 88.91% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek marked this pull request as ready for review October 16, 2026 11:26
@vdusek
vdusek requested a review from szaganek as a code owner October 16, 2026 11:26
@vdusek
vdusek requested review from Mantisus and Pijukatel and removed request for szaganek October 16, 2026 11:26
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 16, 2026
@vdusek
vdusek merged commit 3b128d1 into master Oct 16, 2026
36 of 37 checks passed
@vdusek
vdusek deleted the fix/max-retries-zero branch October 16, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

max_retries=0 raises ValueError on every request

3 participants