Apify and Crawlee Official Forum

Updated 3 months ago

Actor Standby Question

How to know if current Actor have StandBy mode enabled.
So.. the Actor can decide whether it should activate HTTP server or run normal Codes.
Is there any API or ENV variable that I could use ?

Thank You!
L
!
6 comments
Hi

You can check these two articles about the StandBy mode
https://docs.apify.com/platform/actors/running/standby
https://docs.apify.com/platform/actors/development/programming-interface/standby

But in short you should see the option in settings if its enabled/disabled or by checking the standby navigation option next to the input.
Thanks for . What I mean is, how to know programmatically.
You can check the

https://docs.apify.com/platform/actors/development/programming-interface/standby

There is code example in JS/Python. If you see something like Actor.config.get('standbyPort') its using the StandBy mode.
And also standby should be automatically enabled after you create your template.
I have tried Actor.config.get('standbyPort') it always return a port number, even though StandBy mode is DISABLED. I have tried the example codes and enable standby mode. When I run the Actor via web console, it always run the HTTP server. I want the Actor not to run HTTP server when it run from web console or normal API.
I've checked with the team and
you can have a look at the APIFY_META_ORIGIN environment variable, and if it equals "STANDBY", it means that the run is started via Standby mode. If the run is started via the Console or API (or any other way), it will contain something else.
The standbyPort configuration option will always be present there, even if Standby mode is disabled.
that is exactly what I'm looking for. Thank You ! πŸ™πŸ» 🀝 😊
Add a reply
Sign up and join the conversation on Discord