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!
6 Replies
cloudy-cyan
cloudy-cyan10mo ago
Hi @!!!Joefree!!! 👑 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.
Actor Standby | Platform | Apify Documentation
Use the Actor as a real-time API server.
Actor Standby | Platform | Apify Documentation
Use the Actor as a real-time API server.
!!!Joefree!!! 👑
!!!Joefree!!! 👑OP10mo ago
Thanks for @Lukas Celnar . What I mean is, how to know programmatically.
cloudy-cyan
cloudy-cyan10mo ago
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.
Actor Standby | Platform | Apify Documentation
Use the Actor as a real-time API server.
!!!Joefree!!! 👑
!!!Joefree!!! 👑OP10mo ago
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.
cloudy-cyan
cloudy-cyan10mo ago
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.
!!!Joefree!!! 👑
!!!Joefree!!! 👑OP10mo ago
that is exactly what I'm looking for. Thank You ! 🙏🏻 🤝 😊

Did you find this page helpful?