fix: Limit timeout to minimum of 1 seconds when timeout='inherit'#1051
Merged
Conversation
…emaining When `timeout='inherit'` was used and the current run was already past its own timeout, the remaining time was clamped to zero and sent to the API as `timeout=0`, which the platform treats as "no timeout" - the other Actor run would get unlimited runtime instead of inheriting the (exhausted) time budget. A positive sub-second remainder had the same problem, as the API client truncates the timeout to whole seconds. The remaining time is now rounded up to whole seconds, so it is never truncated to zero, and when no time remains, `Actor.start`, `Actor.call` and `Actor.call_task` skip the API call entirely, log a warning and return `None`. Overloads keep the `Run` return type for calls that do not use `timeout='inherit'`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E5mT2U8shnNpysaq8NdtZe
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E5mT2U8shnNpysaq8NdtZe
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1051 +/- ##
==========================================
+ Coverage 91.77% 91.87% +0.10%
==========================================
Files 50 50
Lines 3222 3225 +3
==========================================
+ Hits 2957 2963 +6
+ Misses 265 262 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vdusek
reviewed
Jul 16, 2026
vdusek
reviewed
Jul 16, 2026
inherit timeout option when no timeout left
Contributor
Author
|
A 1-second timeout might be more practical, as it retains the type and behavior consistency while having a kind of the same end-user behavior. |
Pijukatel
pushed a commit
to apify/apify-sdk-js
that referenced
this pull request
Jul 16, 2026
…ng the run Match the approach merged in the Python SDK (apify/apify-sdk-python#1051): when `timeout: 'inherit'` is used and the current run is already past its own timeout, the started run now gets the smallest API-accepted timeout of 1 second (resulting in an almost certain timeout of the started run) instead of being skipped. The API treats a timeout of 0 as no timeout at all, which is why the value is never allowed to reach 0. This removes the skip behavior, the `| undefined` return types and the overloads - `Actor.start()`, `Actor.call()` and `Actor.callTask()` always return the run object again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E5mT2U8shnNpysaq8NdtZe
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.
Limit the minimum possible timeout to 1 second when using timeout='inherit'. 1s is the smallest possible API timeout value and will result in an almost certain timeout of the called actor.
Previously, the timeout value got set to 0, but the API interprets a timeout of 0 as no timeout at all.