Shut deployed service down

Hey there,
I have working python script that starts the render worker like this:
def heartbeat():
return jsonify({“status”: “alive”}), 204

def action(actionData):
if str(actionData)[0] == “9”:
return jsonify({“status”: “alive”}), 200
threading.Thread(, kwargs={‘host’: ‘’, ‘port’: 10000}).start()

(i know this is very unsecure i dont care for this project though)
and on the main thread is the program running the main program loop and another thread that does some extra stuff too. Since render doesnt give you a way to stop your worker if it fully deploys and runs, i thought of doing the /action/ thing to maybe shut it down but this doesnt work either? the worker just doesnt shut down. Is there another way to make this work?

tldr; is there any way to fully crash the worker after its started

Render keeps services running. A shutdown is unexpected while it is scaled up so the Render platform starts it back up. If you want to shut down a service, scale it down to 0 instances ( Scale service to desired number of instances ).