Repository navigation
feat: retry starting a run on memory and concurrent-runs limits - #1091
Merged
Merged
Conversation
Contributor
|
See more at https://github.com/apify/apify-client-js/actions/runs/37508511779#summary-112423238764 |
vdusek
force-pushed
the
feat/wait-for-resources
branch
from
September 30, 2026 07:59
923c49f to
509812b
Compare
vdusek
marked this pull request as ready for review
October 6, 2026 06:08
barjin
approved these changes
Oct 6, 2026
vdusek
added a commit
to apify/apify-client-python
that referenced
this pull request
Oct 7, 2026
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
added a commit
that referenced
this pull request
Oct 7, 2026
`dispatches().list() is async-iterable` failed on [a PR #1091 run](https://github.com/apify/apify-client-js/actions/runs/37508511779/job/112423238579) with 0 dispatches collected. The test polled one listing read until the dispatch showed up, then asserted on a second, separate read. Listing endpoints read from Mongo secondaries, so the second read can hit a lagging replica and come back empty. The test now drains the iterator with `collectUntilPresent` (from #1090) and waits for the id returned by `test()`, so the retried read is the one it asserts on. It also checks for that specific dispatch, which is stricter than "at least one". *✍️ Drafted by Claude Code*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
waitForResourcesoption toActorClient.start()/call()andTaskClient.start()/call(). When set, a start that the API rejects withactor-memory-limit-exceededorconcurrent-runs-limit-exceededis retried every 10 seconds. Orchestrators no longer need their own wait-and-retry loop.trueretries until the run starts. A number of seconds limits the retrying, after which the last 402 error is thrown.signalaborts the wait between attempts.call(), the retry time doesn't count towardwaitSecs.Readableinput can't be sent twice, so its start is never retried.actor-memory-limit-exceedederror and never starts, sotrueretries 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 an example. The Python twin is apify/apify-client-python#1081 and uses the same design.
Closes #1074
✍️ Drafted by Claude Code