Prevent machine being suspended while active despite `min_machines_running = 0`

I host a FastAPI api that creates a bot to join in to a daily.co realtime chat. I start a bot by calling an API endpoint that creates a subprocess with subprocess.Popen("python -m bot"). Now after a while fly decides that the machine is idle and shuts it down despite the bot being active all the time (it’s an async function that is being awaited).

auto_stop_machines is active, and I want to machine to stop when there is really no activity. So I wonder whether I can keep the machine alive with HTTP calls or make fly aware of that process. I wonder whether the processes section in the fly.toml would help me with this?

Any hints! Many thanks!

Set auto_stop_machines to false, and call process.exit(0) when there really is no activity.

Note: it is important that you exit with a status code of 0 so that fly doesn’t treat this as an error.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.