Hello!
We have a python application that exits with a runtime error, then it is immediately restarted automatically. Is there a way to put a delay between the application exit and when the supervisor restarts the service?
See logs for timestamps:
[Logs] [2023-08-30T05:59:21.447Z] Service exited 'main sha256:d32dcf1d7d5b77dfe39c2d67298689918443b7c077dcc43508e3892199e0d0c7'
[Logs] [2023-08-30T05:59:22.170Z] Restarting service 'main sha256:d32dcf1d7d5b77dfe39c2d67298689918443b7c077dcc43508e3892199e0d0c7'
Unfortunately I don’t believe that there is a way to do this right now. Could you describe the issue that automatically attempting to restart the container causes for you, maybe there’s other workarounds that might help you
If you are using Systemd as your supervisor on a Linux system, you can modify the service unit configuration to introduce a delay before restarting the service. You can do this by editing the service unit file (typically found in /etc/systemd/system/) and adding a delay using the RestartSec option. For example:
[Service]
ExecStart=/path/to/your/python_script.py
Restart=on-failure
RestartSec=10 # Add a 10-second delay before restarting