I have a nested logic app which takes some time for 4 retries in case of a failure. According to the documentation, the default HTTP timeout is 100 seconds. I'm able to increase the HTTP client timeout value in my code which triggers the parent logic app, but in case of a failure in the child logic app, it is retried 4 times and takes much longer. Meanwhile, the parent logic app responds with a 504 (gateway timeout). There are some more actions to take care of after the child logic app returns a response, so I can't make it asynchronous and return 202 to the code trigger. Is there a way to increase the timeout in the nested logic app without making it async?
E.g. - My nested logic app retried 4 times and failed after 4 minutes
However, my code already receives a response of 504 after 2 minutes 9 seconds of triggering the parent logic app
The HTTP client which triggers the parent logic app has a timeout of 20 minutes. I verified that this timeout value is working, because without it, we were receiving the timeout reponse in 1 minute 40 seconds (100 seconds), which is default HTTP trigger timeout. I'm under the impression that if the nested logic app also doesn't respond within 100 seconds of being triggered, the parent throws a timeout because it didn't receive a response. Is there a way to work around this?
I figured out that Azure has a timeout value on incoming HTTP requests and the connection cannot be kept open for more than 2 minutes. This is different from the HTTP client timeout of 100 seconds. So, even though I increased the HTTP client timeout, the Azure logic app couldn't keep the incoming connection open for more than 2 minutes and hence was throwing a 504 Gateway Timeout.
Since my logic app takes more than 2 minutes to finish running, to fix this issue, I started using the asynchronous polling mechanism, by responding to the incoming HTTP request with a 202 (Accepted), and then polling the location sent in this response from my code every 3 minutes till the response status != 202.
From what I understand, the above solution of using HTTP webhooks might also work, because the client timer is paused when we use webhooks. However, that wasn't possible for me, so I had to change my design and use the asynchronous polling pattern.