Using a file to signal shutdown to the java agent, like we do for the soft restart.
As for the soft restart, a thread in the Java agent polls this file and triggers shutdown by explicitly clicking on the Gateways's File -> Close menu item.
Note: wasn't able to reproduce the issue neither in the cloud nor locally.
In the cloud, tried deploying an algorithm that throws and checking the automatic re-deployment option.
In a local environment inside a container a bash script was used to deploy an algorithm that throws an exception (in Initialize and in OnData) and re-deploy it N times to check whether any of those re-deployments failed trying to connect to IB, but it always connected without issue. Nevertheless, this PR would be a good prevention measure for this bug.
File -> Close
menu item.Note: wasn't able to reproduce the issue neither in the cloud nor locally.
Close https://github.com/QuantConnect/Lean.Brokerages.InteractiveBrokers/issues/91