Skip to content

Conversation

@Pijukatel
Copy link
Contributor

@Pijukatel Pijukatel commented Nov 28, 2025

  • Add RemainingTime timeout option for Actor.call, Actor.start and Actor.callTask. This will set the timeout of another Actor run to whatever is left from the timeout of the current Actor run

Related to: apify/apify-client-js#632
Python implementation: apify/apify-sdk-python#473

@Pijukatel Pijukatel added the t-tooling Issues with this label are in the ownership of the tooling team. label Nov 28, 2025
@github-actions github-actions bot added this to the 128th sprint - Tooling team milestone Nov 28, 2025
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Nov 28, 2025
@Pijukatel Pijukatel changed the title feat: Add 'RemainingTime' timeout option for Actor.call and Actor.start feat: Add RemainingTime timeout option for Actor.call and Actor.start Nov 28, 2025
@Pijukatel Pijukatel force-pushed the add-remaining-time-timeout-option branch from 08efc4b to 3fc6e13 Compare November 28, 2025 13:53
@Pijukatel Pijukatel force-pushed the add-remaining-time-timeout-option branch from 3fc6e13 to 8cbd80d Compare November 28, 2025 13:54
@Pijukatel Pijukatel marked this pull request as ready for review November 28, 2025 13:56
Copy link
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

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

This looks pretty straightforward implementation-wise, so it's almost a go from me 👍

I have these two points to discuss:

* Using `RemainingTime` will set timeout of the other Actor run to the time
* remaining from this Actor run timeout.
*/
timeout?: number | 'RemainingTime';
Copy link
Member

Choose a reason for hiding this comment

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

The Pascal-cased string constant doesn't feel right, format-wise. How about 'inherit'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about the common casing of string literals in JS, but this is the same literal as in the Python implementation. So, unless there is some name suggestion that is better by a lot, then I would prefer to keep it consistent.

Copy link
Member

Choose a reason for hiding this comment

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

I also like inherit much better.

Copy link
Contributor

@janbuchar janbuchar Dec 2, 2025

Choose a reason for hiding this comment

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

So what do we do with the Python version now? Deprecate RemainingTime in favor of inherit?

Copy link
Member

Choose a reason for hiding this comment

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

I'd be up for that, what do you think about the naming here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I don't mind it 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Pijukatel Pijukatel requested a review from barjin December 1, 2025 08:19
@Pijukatel Pijukatel force-pushed the add-remaining-time-timeout-option branch 2 times, most recently from 4adfd51 to f8962e6 Compare December 1, 2025 08:35
@Pijukatel Pijukatel force-pushed the add-remaining-time-timeout-option branch from f8962e6 to 358ad03 Compare December 1, 2025 08:36
@Pijukatel Pijukatel force-pushed the add-remaining-time-timeout-option branch from 1d8b73b to f8f383f Compare December 1, 2025 09:35
*/
private _getRemainingTime(): number | undefined {
const env = this.getEnv();
if (env.isAtHome === '1' && env.timeoutAt !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (env.isAtHome === '1' && env.timeoutAt !== null) {
if (Boolean(env.isAtHome) && env.timeoutAt !== null) {

Copy link
Member

Choose a reason for hiding this comment

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

should be just this.isAtHome()

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, we're in Actor 🤦 you're right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using this.isAtHome()

return env.timeoutAt.getTime() - Date.now();
}
log.warning(
'Returning `undefined` instead of remaining time. Using `inherit` argument is only possible when ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

The user reading this message won't understand what "Returning undefined" means. I think we could just remove the first sentence and keep the second one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, removed.

@Pijukatel Pijukatel requested review from B4nan and janbuchar December 3, 2025 08:32
Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

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

the changes in the lockfile feels a bit suspicious, surely unrelated

Copy link
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

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

lgtm, thank you!

Two nits:

  • please update the PR title (inherit instead of RemainingTime)
  • When do we add this option for ActorTask.call / start? Should this happen in this PR?

@Pijukatel Pijukatel changed the title feat: Add RemainingTime timeout option for Actor.call and Actor.start feat: Add inherit timeout option for Actor.call and Actor.start Dec 3, 2025
@Pijukatel Pijukatel force-pushed the add-remaining-time-timeout-option branch from 39db1a1 to a9b4507 Compare December 3, 2025 12:01
@Pijukatel Pijukatel merged commit 4bf3c0e into master Dec 4, 2025
10 checks passed
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.

5 participants