Running processes interrupted when deploying Azure App Service

We are moving to Azure and need to get a solution regarding batch jobs vs App Service deployment/restarts.
We have quite a lot of App Services running Ubuntu Linux/PHP. On almost every one, we have batch jobs started by Logic Apps in Azure.
There is also a staging slot to each production slot.
The problem here is that when we are deploying new code (via Pipelines) out to the App Service, the server will get restarted.
That means that if the Logic App has started a long running PHP batch job, the process will get interrupted when we are deploying out to the production server due to the restart. In this case the staging/production slot configuration doesn't help us getting an uninterrupted batch job process since the swap doesn't check for running processes before swapping.
Does anyone have a solution to how we could solve this problem?
Thank you