Skip to content

feat: retry starting a run on memory and concurrent-runs limits - #1081

Open
vdusek wants to merge 8 commits into
masterfrom
feat/wait-for-resources
Open

vdusek wants to merge 8 commits into
masterfrom
feat/wait-for-resources

Conversation

@vdusek

@vdusek vdusek commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds a wait_for_resources argument to ActorClient.start/call and TaskClient.start/call, sync and async. When set, a start that the API rejects with actor-memory-limit-exceeded or concurrent-runs-limit-exceeded is retried every 10 seconds. Orchestrators no longer need their own wait-and-retry loop.

  • True retries until the run starts. A timedelta limits the retrying, after which the last 402 error is raised.
  • Any other error is raised right away.
  • In call, the retry time doesn't count toward wait_duration.
  • A file-like input is read into memory before the first attempt, so every retry sends it whole.
  • A run that asks for more memory than the account's whole memory limit gets the same actor-memory-limit-exceeded error and never starts, so True retries it forever. The API has no separate error type for that case. The docs call it out.

The Retries concept page gets a section with sync and async examples. The JS twin is apify/apify-client-js#1091 and uses the same design.

Closes #1071

✍️ Drafted by Claude Code

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

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.35%. Comparing base (ae17148) to head (2ded90e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1081      +/-   ##
==========================================
+ Coverage   87.75%   95.35%   +7.59%     
==========================================
  Files          60       61       +1     
  Lines        5757     5808      +51     
==========================================
+ Hits         5052     5538     +486     
+ Misses        705      270     -435     
Flag Coverage Δ
integration 91.15% <56.36%> (?)
unit 88.13% <100.00%> (+0.38%) ⬆️

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 linked an issue Sep 30, 2026 that may be closed by this pull request
@vdusek
vdusek requested a review from Mantisus October 6, 2026 06:08
@vdusek
vdusek marked this pull request as ready for review October 6, 2026 06:08
@vdusek
vdusek requested a review from szaganek as a code owner October 6, 2026 06:08
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 6, 2026
@Mantisus

Mantisus commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Could you rebase onto master to make sure this works correctly with the request body streaming added in #1060?

@Mantisus Mantisus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@apify-approval-mirror apify-approval-mirror Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Mirroring approval from @Mantisus.

This branch has not been deployed

No deployments
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.

Retry starting a run on memory and concurrent-runs limits

3 participants